POV-Ray : Newsgroups : povray.newusers : Bicubic Patches? : Re: Bicubic Patches? Server Time
5 Nov 2024 15:57:02 EST (-0500)
  Re: Bicubic Patches?  
From: Scott David Daniels
Date: 5 May 1999 01:41:23
Message: <372FCC5A.B26E2CD7@Acm.Org>
Some basic terms:
A _spline_ blends two functions smoothly (for some notion of smooth).
We choose _cubic_ polynomials since they are the lowest degree
polynomials which can "reverse direction" (as in an "S" curve). 
It is _bicubic_ because we are working with a "square" patch -- we have
two sides at "right" angles each controlled by a Bezier curve, to
produce a patch by varying each side over its range.
A _control_point_ is a point that controls some parameter of our curve.
A _knot_ is a control point that the curve must lie on.

Let's start our explanation with one edge in 2-D and scale up.  A
_Bezier_curve_ has four control points, two of which (the first and
fourth) are knots.  The other two control the path between the first and
final points.  If the points are A, B, C, and D in order, then A is a
knot, the vector from A to B is the initial slope of the path, D is a
knot, and when the path meets D it is traveling at the slope of the
vector from C to D.

A neat property of these curves is that the entire curve is always
inside the quadrilateral bounded by A, B, C and D (if the points
zig-zag, the vertices of the bounding quadrilateral may have to be used
in another order).  All of these
properties are independent of any linear transform of the coordinate
space, so you can understand them graphically.  Another neat property is
that the curve can be cut anywhere into a pair of Bezier curves, and the
resultant pair of curves will trace the same points as the original. 
This is good for graphics applications where you may subdivide to see
where a hit point occurs.

So far we have a curve in 2-D.  We can easily give 3-D points for those
four points (makers perfect sense), and we sort of lose the "curve is 
bounded by the quadrilateral" property.  We really don't however, since
and 2-D shadow of our 3-D points produces a curve which is the 3-D 
shadow of the 3-D curve.

Now for a really simple example, let's lay out a line, making the inner 
control points intermediate points on the line between A and D.  Say:
	A = (0,0,0), B = (1,0,0), C = (2,0,0), D = (3,0,0)

We set another Bezier curve parallel to this but offset:
	A'= (0,6,0), B'= (1,6,0), C'= (2,6,0), D'= (3,6,0)

Now we connect the end knots with our straight-line Beziers
	A = (0,0,0), A1= (0,2,0), A2= (0,4,0), A'= (0,6,0)
  and	D = (3,0,0), D1= (3,2,0), D2= (3,4,0), D'= (3,6,0)

We now have our "patch" outlined: A, A', D', D
We simply fill in the intermediate control points with connections
the same way we did the outer, and re-use the intermediate points:

	A = (0,0,0), A1= (0,2,0), A2= (0,4,0), A'= (0,6,0)
  and	B = (1,0,0), B1= (1,2,0), B2= (1,4,0), B'= (3,6,0)
  and	C = (2,0,0), C1= (2,2,0), C2= (2,4,0), C'= (3,6,0)
  and	D = (3,0,0), D1= (3,2,0), D2= (3,4,0), D'= (3,6,0)

So, A-B-C-D, D-D1-D2-D', D'-C'-B'-A', and A'-A2-A1-A bound our patch.

The points B, C, D1, D2, C', B', A2, and A1 control the "wobbliness" 
of the edges.  Lift or lower them a bit to see what happens.

What we really have is a sweep of a Bezier by a Bezier.  At one edge
of our patch we go from A,B,C,D, sweep along to arrive at A',B',C',D'.
Clearly the "A" edge follows the Bezier A-A1-A2-A'.  Similarly the "D" 
edge follows D-D1-D2-D'.  It should not shock you that the control 
points follow Bezier paths B-B1-B2-B' and C-C1-C2-C'.

This is completely symmetric.  We could consider that A-A1-A2-A' is
swept until it becomes D-D1-D2-D'.

To experiment with this, start with a plain box, six sides using 
straight-line Beziers.  Then deflect points: push out the X1s from 
the center of the box, and push in the X2s towards the center for 
example.  As long as the edges match, you can even warp the edges 
off their straight lines.  If you like, you can even split the box
at an edge, by having the attaching edge not use exactly the same 
control points.

Phil Clute wrote:
> 
> The answer to this question is probably going to go way
> over my head, but here goes...
> I'm trying to figure out just how these bicubics work.
> The pov docs say I should use a modeller, but I wanted to
> try my luck at animating a few patches together, in harmony
> using variables for the control points. However, only the
> corners(as far as I know) are stable, that is to say each
> corner actually resides at the point in space indicated by its
> vector.
> Lets say I have 2 patches side by side, each patch is a square,
> together forming a rectangle. When I pull on a corner the middle
> seam comes apart.
> So, the question is: What frightening math equation do I need to
> know and love in order to keep those seams together.
> 
> Note: I am mathematically challenged...please explain as though
> you are speaking to a moron, because you are. :-)
> 
> --
> ...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.