Cubic Splines

Cubic Splines

Tags
robotics
Published
October 16, 2020
Author
Chris Chan

Cubic Splines

A cubic spline is constructed from a series of piecewise third degree polynomials. Given control points
We can construct segments where the th segment is computed as:
with
Typically we set the 2nd derivative of each to 0 at the endpoints to create a system of equations that we can solve for .
Having solved for all s solve for and using:

Derivation

We seek to solve for , , and for each segment of the spline with .
Since all terms go zero when , we can easily get with .
We require our function function to be continuous and twice differentiable. The zeroth, first and second derivative with respect to x for each segment is reproduced below.
Let us define and substitute from here on.
  • Continuous zeroth derivative means . For .
  • Continuous first derivative means . For .
  • Continuous second derivative means . For .
From the three equations above, we seek to express and in terms of .
Lets start off with expressing in terms of using
We can also express in terms of using .
Sub in .
Subbing our expressions for and into the equation formed from .
Because we set the second derivative to zero at the end points of the spline, we can set . So we only have to solve for 's. Conveniently, we have "versions" of the equation above with . This allows us to create a system of linear equations of the form where we can solve for all 's. The top left and bottom right 1s in the matrix encode , the rest of the matrix expresses encodes the equations for
Having solved for all s we can use our expressions for and in terms of to solve for our final coefficients.