Online Example::Closed-loop Catmull-Rom spline

A common misconception among beginning computation geometry students is that the extra control points at the beginning and end of a Catmull-Rom spline somehow represent tangent handles. Recall that the tangent at a knot is parallel to the chord between previous and successive points. This leads to a very simple strategy for forming a smooth, closed loop through the beginning knot, as shown in the following diagram.

The red marker indicates the first auxiliary control point. The green marker indicates the outermost auxiliary control point. The direction of the vector from initial knot to each control point is along the chord emanating from the first knot. The distance from first knot to both the second and next-to-last knots determines the distance along each chord to place the auxiliary control points. The first auxiliary control point is placed along the chord from the first knot to the next-to-last knot, but at a distance equal to that from the first to second knot. The process is reversed for the outermost auxiliary control point.

The graphic illustration should convince you of at least G-1 continuity. What would have to be modified for C-1? Although this approach is easy to illustrate and implement, it is not without issues. You are encouraged to download the code and experiment with different placement srategies for the outer control points.

To experiment with the online demo, enter at least four points and click 'Draw' to automatically close and draw the Catmull-Rom spline. Closure is automatic when the 'closed' property is set to true.

You need to upgrade your Flash Player

This example requires the Flash™ 9 player.

Click the 'Reset' button to try again with a new set of points. Vary the spacing between the points to observe the results. Why is the arbitrary parameterization limited to the interval [0.2, 0.8]?

For further reading,

:: Catmull-Rom Splines - An introduction to Catmull-Rom Splines.

Source Code. Download the Singularity package (this example is in Singularity/demos/CRClosedSpline.mxml).