# Centripetal Catmull–Rom spline

# Centripetal Catmull–Rom spline

`Incomputer graphics,`

**centripetal Catmull–Rom spline**is a variant form ofCatmull-Rom spline, originally formulated byEdwin CatmullandRaphael Rom^{[1]}, which can be evaluated using a recursive algorithm proposed by Barry and Goldman.^{[2]}It is a type of interpolating spline (a curve that goes through its control points) defined by four control points, with the curve drawn only fromto.Definition

`Letdenote a point. For a curve segmentdefined by pointsand knot sequence, the centripetal Catmull-Rom spline can be produced by:`

where

and

`in whichranges from 0 to 1 for knot parameterization, andwith. For centripetal Catmull-Rom spline, the value ofis. When, the resulting curve is the standard uniform Catmull-Rom spline; when, the product is a chordal Catmull-Rom spline.`

`Plugginginto the spline equationsandshows that the value of the spline curve atis. Similarly, substitutinginto the spline equations shows thatat. This is true independent of the value ofsince the equation foris not needed to calculate the value ofat pointsand.`

Advantages

Centripetal Catmull–Rom spline has several desirable mathematical properties compared to the original and the other types of Catmull-Rom formulation.^{[3]} First, it will not form loop or self-intersection within a curve segment. Second, cusp will never occur within a curve segment. Third, it follows the control points more tightly.

Other uses

In computer vision, centripetal Catmull-Rom spline has been used to formulate an active model for segmentation. The method is termed **active spline model**.^{[4]} The model is devised on the basis of active shape model, but uses centripetal Catmull-Rom spline to join two successive points (active shape model uses simple straight line), so that the total number of points necessary to depict a shape is less. The use of centripetal Catmull-Rom spline makes the training of a shape model much simpler, and it enables a better way to edit a contour after segmentation.

Code example in Python

The following is an implementation of the Catmull–Rom spline in Python.

Code example in Unity C#

For an implementation in 3D space, after converting Vector2 to Vector3 points, the float could be extended a in function GetT to this : Mathf.Pow((p1.x-p0.x), 2.0f) + Mathf.Pow((p1.y-p0.y), 2.0f) + Mathf.Pow((p1.z-p0.z), 2.0f).

See also

Cubic Hermite splines

## References

*Computer Aided Geometric Design*. pp. 317–326. doi:10.1016/B978-0-12-079050-0.50020-5. ISBN 978-0-12-079050-0.

*A recursive evaluation algorithm for a class of Catmull–Rom splines*(PDF). Proceedings of the 15st Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH 1988.

**22**. Association for Computing Machinery. pp. 199–204. doi:10.1145/378456.378511.

*Computer-Aided Design*.

**43**(7): 747–755. CiteSeerX 10.1.1.359.9148. doi:10.1016/j.cad.2010.08.008.

*Digital Signal Processing*.

**35**: 64–74. arXiv:1402.6387. doi:10.1016/j.dsp.2014.09.002.

*A recursive evaluation algorithm for a class of Catmull–Rom splines*