In previous posts, we discussed linear and cubic interpolation. So let us continue where we left the last entry: Cubic interpolation does not guaranty that neighboring patches join with the same derivative and that may introduce unwanted artifacts.
Well, the importance of those artifacts may vary; but we seem to be rather sensitive to curves that change too abruptly, or in unexpected ways. One way to ensure that cubic patches meet gracefully is to add the constraints that the derivative should be equal on both side of a joint. Hermite splines do just that.
The system of equation for a cubic polynomial has four equations and four unknowns, all concerned with fitting the four support points (read back the last entry in the series, if need be). But Hermite splines will have some of the equations to describe derivatives, i.e., the slope at the end points.
A cubic polynomial is given by
and its derivative relative to by
So we rewrite the cubic equation system by replacing the last two equations by the derivatives, which will constrain the solution:
where and are the wanted derivatives at and , respectively. We then solve for . Again, with special cases and , the system simplifies a lot:
and the inverse is:
and we solve, finally, with
Now remains to decide how we choose and , the derivatives at and , respectively. One way is to set them as zero, so that each point is surrounded by a flat region, but that doesn’t seem to have all the naturalness one could want.
One other way, is to look at the neighbors, a bit further, and , and guess sensible slopes. That’s what cardinal splines do, and quite simply, at that.