Catmull-Rom
splines interpolate a set of
control
points, and
are guaranteed to
pass through the
control points (except for the first and last points).

A
Catmull-Rom
spline has the following properties:
- It passes through the middle two points,
and interpolates the space between them

- The tangents at p1 and p2
are:

Since
there are four
constraints, we
will have four
unknowns in
the spline equation (i.e., we will have a cubic spline ).
Cubic spline equation:

The
goal
is to derive a, b, c and d using the constraints. This will
then give the precise form of
x(t).

Four
linear equations with four unknowns:

This
is easily solved using algebra to determine
a,
b,
c, and
d!
The
four equations can be solved, giving the result:

Given four control points (
p0, p1, p2, p3), we
can compute
a,
b,
c, and
d. Then, we can sample the curve

at regular intervals along the
interval t=[0,
1] to generate points along the spline spanning the space between
p1 and
p2.