Created by: portnov
Catmull-Rom splines have the following advantages:
- They are widely used in some areas like game design
- They are quite fast to compute — about as fast as our "cubic spline" (which is otherwise known as "natural spline", if I understood correctly)
- They go exactly through specified points (i.e. they are interpolating)
- They can be easily converted to Bezier segments or Nurbs curves.
- In some implementations (see below), they allow to control the "degree of smoothness" with additional "tension" parameter
But these splines also have some disadvantages:
- They have only C1 continuity, i.e. first derivative is continuous, but second is not.
- As consequence, their curvature can change very fast — they can be "very curvy" at one points and "almost straight" in others. But this property can be useful in some applications, when you want the spline to go almost by straight lines, just rounding the corners a bit.
This node supports two variants of Catmull-Rom spline:
- Non-uniform spline. See https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline . In this implementation, each spline segment (between two successive points) is assigned with different span of T parameter, which is calculated based on distance between points (several metrics are supported). This has the effect of the curve being more "curvy" in places where control points are far from one another, and more flat where control points are near. This usually gives the feeling of curve being more "natural".
- Uniform spline. In this implementation, each spline segment is assigned with equal span of T parameter. As effect, it is possible that the curve will be unexpectedly more "curvy" when successive control points are near one another. But this implementation has an option to control the degree of curve "smoothness" by additional "tension" parameter. It is also possible to specify tension value for each curve segment.
Uniform (yellow) vs non-uniform (green) spline:
Non-uniform splines with Euclidean metric (yellow) and with centripetal metric (green):
Non-uniform (Euclidean) Catmull-Rom spline (yellow) vs Cubic spline (blue):
Uniform splines with different tension values: from 0.2 (almost black lines) to 2.0 (white line):
Preflight checklist
Put an x letter in each brackets when you're done this item:
-
Code changes complete. -
Code documentation complete. -
Documentation for users complete (or not required, if user never sees these changes). -
Manual testing done. -
Unit-tests implemented. -
Ready for merge.