|
Bezier Curves
The bezier curve is defined for a single segment,
which has two endpoints and two 'handles', one for each endpoint. When
two segments are joined and share an endpoint, that point has two handles,
one from each segment. If these handles are on a line with the endpoint
the segments join smoothly.

For each segment of the curve, a parametric
function using cubic polynomials of x and y is constructed:
x(p) = Axp3 + Bxp2
+ Cxp + x0
y(p) = Ayp3 + Byp2 +
Cyp + y0
The range for p is p:0->1. The coefficients
of the two polynomials are derived from the coordinates of the four points
of the segment according to the definition of a bezier curve:
Cx = 3 (x1 - x0)
Bx = 3 (x2 - x1) - Cx
Ax = x3 - x0 - Cx - Bx
Cy = 3 (y1 - y0)
By = 3 (y2 - y1) - Cy
Ay = y3 - y0 - Cy - By
The Bezier Demo
In the bezier demo, the bezier class (script)
accepts a list of points and constructs the parametric functions for the
curves that connect those points smoothly.
To do this it generates the points for the handles in a
generic way, splitting the angle evenly between adjoining segments. Then
it finds the coefficients for the equations for each segment as described
above.
The slope of the bezier curve at any point
is (change in y / change in x), or (dy/dx).
dx(p) and dy(p) are given by evaluating the derivates
of the two cubic polynomials at p. The derivates are:
dx(p) = 3Axp2 + 2Bxp +
Cx
dy(p) = 3Ayp2 + 2Byp + Cy
Other Spline Resources
Spline
Curves and Surfaces - some good spline applets
Vector
Shapes as Animation Tools - using Director's vector shapes
|