Home > Flex, Math > Quadratic Hermite Curves Part 5

Quadratic Hermite Curves Part 5

September 3, 2009

Part four of this series illustrated how to join two quadratic Hermite curves with C-1 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 two-segment case that interpolates three points, P0, P1, and P2.   The start tangent vector for the first segment is T0 and the start tangent for the second segment is T1.  Both tangents are functions of t.  T0 is shorthand notation for the tangent at t=0 for the first segment. T1 refers to the tangent at t=0 for the second segment.  T0(1) refers to the end tangent of the first Hermite segment.  T1(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 (P1) is that T0(1) = T1.  Recall from part 2 of this series that T0(1) = 2(P1 – P0) – T0, so T1 = 2(P1 – P0) – T0 or T0 + T1 = 2(P1 – P0).   Note that T1 can not be computed until T0 is fixed.   If another segment is added, there is a similar boundary condition for T2 in terms of T1(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 = [ T0 T1 ... Tn-1 ]t
b = 2[P1-P0 P2-P1 ... Pn-1-Pn-2]t

For n data points, A is n-1 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 T0 fixed, there are n-1 tangents to be computed.  The first row of A yields one equation in one unknown, T1.  Once T1 is computed, the second row yields an equation for T2 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🙂

Categories: Flex, Math Tags: , ,
  1. No comments yet.
  1. September 11, 2009 at 7:02 am
Comments are closed.
%d bloggers like this: