Closed Loop Bezier Spline
I finally found a bit of free time to upgrade the cubic Bezier spline, adding arc-length parameterization and closed-loop support. Curve closure is automatic and handled by a new ‘closed’ setter function in the BezierSpline class. The new BezierClosedSpline.mxml demo is illustrated in the following diagram,
C-1 continuity is preserved through the loop by using the tangent to the angle bisector from knots n-2, 0, 1 (as knots 0 and n-1 are the same). The control cages for each cubic segment are illustrated in the following diagram.
The spline now supports arc-length parameterization. The orange markers in the above diagrams show the original knots. The green markers are generated from a default uniform parameterization. The demo illustrates the difference between uniform and approximate arc-length paramterization. This allows the spline to be used in path animation with velocity control.
The Singularity package download and a more detailed description of the AS 3 paramteric curve library may be obtained here.
Anyone interested in the methodology for generating the spline may read this TechNote.