Cardinal Splines Part 2
Continuing from part 1 of this series, consider a knot sequence, P0, P1, P2, … Pn-1 . The Cardinal spline fits a sequence of cubic polynomials to these knots, the first of which is between P0 and P1. The second polynomial curve is between P1 and P2, and so forth. Hermite interpolation is used to compute the polynomial coefficients, so start- and end-tangents are required at each knot.
Cardinal splines specify the tangents at interior points based on the vector from previous point to subsequent point. Each tangent is parallel to this vector and some multiple of its length. For example, the tangent direction at point P1 is parallel to the vector P2 – P0, or we could simply write something like T1 = s(P2 – P0) where s is a real number.
An astute reader immediately notices that this is very similar to the approach taken with the Catmull-Rom spline. As it happens, the C-R spline is a special case of the cardinal spline with a fixed multiplier value. It would be helpful to review this TechNote [PDF] on Catmull-Rom splines. The complete derivation of the Cardinal spline basis matrix is provided in the pages leading up to equation 5b.
The Cardinal spline provides an extra control parameter in terms of s. Adjusting this parameter controls the degree to which the spline follows the tangent vector leading into and exiting from the join point.
One item not discussed in detail in the C-R TechNote is that that of locality in terms of knot movement. In some splines, changing the location of a knot has a ‘ripple’ effect through the entire spline. With Cardinal splines, individual cubic polynomials are constructed with overlapping sets of four knots. The sets are
[P0, P1, P2, P3]
[P1, P2, P3, P4]
[P2, P3, P4, P5]
[Pn-4, Pn-3, Pn-2, Pn-1]
Denoting an arbitrary set by
[Pa, Pb, Pc, Pd]
Hermite interpolation is applied to points Pb and Pc with start tangent s(Pc – Pa) and s(Pd – Pb).
So, each knot participates in at most four spline segments. This tends to localize the effect of moving any single knot. Hermite interpolation is very efficient, so there is no system of equations to be solved to compute polynomial coefficients. A price is paid, however, for this convenience and this is loss of second-derivative continuity. A Cardinal spline is at best C-1 continuous.
The next part of this series looks at the s parameter in more detail. While it is tempting to think of it directly as a tension parameter, it is related to tension. It will be shown that the Catmull-Rom spline is a zero-tension or ‘neutral’ Cardinal spline. We will also discuss tangent directions at the initial and terminal knot as these are clearly arbitrary in the above analysis.