Interpolating Cardinal and Catmull-Rom splines

Continuous curve with a kink in Fig.1 is called C 0 continuous. A curve is C k continuous if all k derivatives of the curve are continuous.
continuity Cardinal spline
Interpolating piecewise Cardinal spline is composed of cubic Bezier splines joined with C1 continuity (see Fig.2). The i-th Bezier segment goes through two neighbouring points Pi , Pi+1 . Derivatives at a point Pi are parallel to the Pi-1Pi+1 line, i.e.
    P 'i = (Pi+1 - Pi-1)/a .
Derivatives at the terminal points P0 , Pn go to the neighbouring nodes. Remember, that a cubic Bezier spline is determined by 4 vectors (e.g. four control points or two endpoints and two derivatives at the points). For the i -th segment we have
    B0 = Pi ,   B3 = Pi+1 .
As for Bezier spline
    B'(0) = 3(B1 - B0) ,   B'(1) = 3(B3 - B2) ,
therefore all control points B0,1,2,3 are obtained easy for every segment. Control polygon for the left Bezier segment is shown in Fig.2. Derivatives at P1 are parallel to the P0P2 line. Derivative at the endpoint P0 goes to P1.
One can take different ai values for different points Pi and even different a+,- for the "left" and "right" segments at a point too. For a = 2 we get the Catmul - Rom spline.
You can compare Cardinal (the left picture) and Bezier (the right one) spline curves.
    Cardinal spline applet
Drag the mouse to move the nearest control point (a small blue square).
Drag up-down the small red square to change a from 0 to 4 (you can see a value in the Status bar).
Click mouse + "Shift"("Ctrl") to add (remove) a point.
subdivision Unfortunately the Cardinal curve cannot be subdivided in two sub-curves which coincide with the initial one. As since Fig.3 shows, that in common case the line P0P3 is not parallel to the P02P12 one and the derivative at P(1/2) is not (P3 - P0)/a.

Contents   Previous: Interpolating Lagrange curve   Next: Building cubic B-spline
updated 11 August 2001