The Catmull-Rom splines is a method that approximate a set of points (named control points) with a smooth polynomial function that is piecewise-defined. One of the properties of the Catmull-Rom spline is that the curve will pass through all of the control points.

Two points on each side of the desired portion are required. In other words, points \( P_{i-1} \) and \( P_{i+2} \) are needed to calculate the spline between points \(P_i\) and \(P_{i+1}\).

Given points \(P_{i-1}\), \(P_{i}\), \(P_{i+1}\) and \(P_{i+2}\), the coordinates of a point \(P\) located between \(P_i\) and \(P_{i+1}\) are calculated as:

$$ P = \frac{1}{2} . \left[ \begin{matrix} 1 & t & t^2 & t^3 \end{matrix} \right]. \left[ \begin{matrix} 0 & 2 & 0 & 0 \\ -1 & 0 & 1 & 0 \\ 2 & -5 & 4 & -1 \\ -1 & 3 & -3 & 1 \end{matrix} \right]. \left[ \begin{matrix} P_{i-1} & P_{i} & P_{i+1} & P_{i+2} \end{matrix} \right]^\top $$

The previous equation is a particular case of the general geometry matrix given by the following equation:

$$ P = \left[ \begin{matrix} 1 & t & t^2 & t^3 \end{matrix} \right]. \left[ \begin{matrix} 0 & 1 & 0 & 0 \\ -\tau & 0 & \tau & 0 \\ 2.\tau & \tau-3 & 3-2\tau & -\tau \\ -\tau & 2-\tau & \tau-2 & \tau \end{matrix} \right]. \left[ \begin{matrix} P_{i-1} & P_{i} & P_{i+1} & P_{i+2} \end{matrix} \right]^\top $$

The parameter \(\tau\) modify the tension of the curve. The following figure illustrates the influence of the parameter \(\tau\) on the curve. Note that \(\tau=\frac{1}{2}\) is commonly used (as in the particular case presented previously).

As the spline is \(C^1\) continuous it is possible to compute the derivative for any value of \(t\). Moreover, as the definition of the spline is a polynomial, it is quite trivial to compute the derivative at a given point:

$$ P = \left[ \begin{matrix} 0 & 1 & 2.t & 3.t^2 \end{matrix} \right]. \left[ \begin{matrix} 0 & 1 & 0 & 0 \\ -\tau & 0 & \tau & 0 \\ 2.\tau & \tau-3 & 3-2\tau & -\tau \\ -\tau & 2-\tau & \tau-2 & \tau \end{matrix} \right]. \left[ \begin{matrix} P_{i-1} & P_{i} & P_{i+1} & P_{i+2} \end{matrix} \right]^\top $$

- The spline passes through all of the control points.
- The spline is \(C^1\) continuous.
- The spline is not \(C^2\) continuous.
- The spline does not lie within the convex hull of their control points

Here a simple example of Catmull-Rom spline (and its derivative) created with Matlab:

Closed-loop trajectory (with its derivative):

Example of 3D Catmull-Rom spline:

- catmull-rom-spline-examples-for-matlab.zip (demo script for MATLAB)
## See also

- Calculating the transformation between two set of points
- Check if a number is prime online
- Check if a point belongs on a line segment
- Cross product
- Common derivatives rules
- Common derivatives
- Dot product
- How to calculate the intersection points of two circles
- How to check if four points are coplanar?
- Common integrals (primitive functions)
- Least square approximation with a second degree polynomial
- Least-squares fitting of circles
- Least-squares fitting of sphere
- The mathematics behind PCA
- Online quadratic equation solver
- Online square root simplifyer
- Sines, cosines and tangeantes of common angles
- Singular value decomposition (SVD) of a 2×2 matrix
- Tangent line segments to circles
- Understanding covariance matrices
- Weighted PCA

Last update : 03/14/2021