Bézier Interpolation

The Catmull-Rom Algorithm

Catmull-Rom Splines

\[ \begin{align} F' (t_i)&=\frac{\mathbf{p}_{i+1}-\mathbf{p}_{i-1}}{t_{i+1}-t_{i-1}}\\ F' (t_{i+1})&=\frac{\mathbf{p}_{i+2}-\mathbf{p}_i}{t_{i+2}-t_{i}}\\ F (t_i)&=\mathbf{p}_i\\ F (t_{i+1})&=\mathbf{p}_{i+1} \end{align} \]

If \(u \in [t_i, t_{i+1}]\), the control points of the cubic Bézier curve can be computed as follows: \[ \begin{align} \mathbf{b}^i_0 &= \mathbf{p}_i\\ \mathbf{b}^i_1 &= \mathbf{p}_i + \frac{t_{i+1}-t_i}{3(t_{i+1}-t_{i-1})} (\mathbf{p}_{i+1} - \mathbf{p}_{i-1})\\ \mathbf{b}^i_2 &= \mathbf{p}_{i+1} - \frac{t_{i+1}-t_i}{3(t_{i+2}-t_{i})} (\mathbf{p}_{i+2} - \mathbf{p}_{i})\\ \mathbf{b}^i_3 &= \mathbf{p}_{i+1}\\ \end{align} \]

At the end points of the interval use natural boundary conditions to estimate the tangents. That is

\(F''(t_0)=\frac{6}{(t_1-t_0)^2}\left(\mathbf{b}^0_0-2\mathbf{b}^0_1+\mathbf{b}^0_2 \right)\overset{!}{=}0\) and \(F''(t_k)=...=0\). Thus \(\mathbf{b}^0_1=\frac{1}{2}\left(\mathbf{b}^0_0+\mathbf{b}^0_2 \right)\) and similarly \(\mathbf{b}^{k-1}_2=\frac{1}{2}\left(\mathbf{b}^{k-1}_1+\mathbf{b}^{k-1}_3 \right)\). For the computations we have used the expression of the derivative of a cubic Bézier at the endpoints in terms of the control points.


The JavaScript Code