Quadratic Hermite Curves Part 5
Part four of this series illustrated how to join two quadratic Hermite curves with C1 continuity at the join. This part examines the mathematical foundation of creating a spline that interpolates an arbitrary number of knots using quadratic Hermite segments.
To begin, review the twosegment case that interpolates three points, P_{0}, P_{1}, and P_{2}. The start tangent vector for the first segment is T_{0} and the start tangent for the second segment is T_{1}. Both tangents are functions of t. T_{0} is shorthand notation for the tangent at t=0 for the first segment. T_{1} refers to the tangent at t=0 for the second segment. T_{0}(1) refers to the end tangent of the first Hermite segment. T_{1}(1) refers to the end tangent for the second segment. It is necessary to introduce superscripts and subscripts into the notation at this time.
The boundary condition at the join (P_{1}) is that T_{0}(1) = T_{1}. Recall from part 2 of this series that T_{0}(1) = 2(P_{1} – P_{0}) – T_{0}, so T_{1} = 2(P_{1} – P_{0}) – T_{0} or T_{0} + T_{1} = 2(P_{1} – P_{0}). Note that T_{1} can not be computed until T_{0} is fixed. If another segment is added, there is a similar boundary condition for T_{2} in terms of T_{1}(1). You can show that that the vector of tangents is represented by the equation AT = b, where
A =  1 1 0 0 0 ... 0   0 1 1 0 0 ... 0   . . .   0 0 0 0 ... 1 1  T = [ T_{0} T_{1} ... T_{n1} ]^{t} b = 2[P_{1}P_{0} P_{2}P_{1} ... P_{n1}P_{n2}]^{t}
For n data points, A is n1 x n. The system of equations is underdetermined as expected since the choice of initial start tangent is arbitrary. Once this value is fixed, the system of equations can be easily solved. With T_{0} fixed, there are n1 tangents to be computed. The first row of A yields one equation in one unknown, T_{1}. Once T_{1} is computed, the second row yields an equation for T_{2} in terms of T1. Solving the complete system is a generalization of the approach in part four of this series.
To draw the spline it is not strictly necessary to compute the last tangent, although it is handy to have in the case that new knots are added onto the spline.
Notice that the polynomial coefficients are not directly part of the solution. They follow once the start tangents are set for each segment. It is possible to create a matrix equation for the coefficients, but that requires more effort and we already have software that automatically computes the coefficients once the start tangents are provided.
Although it’s nice to see how the theory all ‘fits together,’ I know you want to see some code, so the final part of this series will introduce a quadratic (interpolative) spline in Degrafa 🙂

September 11, 2009 at 7:02 amQuadratic Hermite Curves Part 6 « The Algorithmist