Catmull-Rom spline through every waypoint (§13 "Catmull-Rom spline"), with
centripetal knot parameterization by default (alpha = 0.5).
Centripetal parameterization is the default because it is the variant that
provably produces no cusps and no self-intersections within a segment, which
is what makes a waypoint path safe to hand to a camera or a robot. alpha = 0
gives the classic uniform spline (which can loop near sharp turns) and
alpha = 1 the chordal one.
Construction
Knots are cumulative chord lengths raised to alpha
(k[i+1] = k[i] + |p[i+1] − p[i]|^alpha, floored at 1e-8 so coincident
waypoints cannot divide by zero). The two end conditions are reflected
virtual points — 2·p₀ − p₁ before the start and 2·pₙ₋₁ − pₙ₋₂ after the
end — rather than duplicated endpoints, which would produce a zero knot
spacing in exactly the formula that divides by it. With two waypoints the
reflection makes the spline the straight line between them at constant speed.
Each segment is the non-uniform cubic Hermite whose tangents are the
Catmull-Rom finite differences
time maps affinely onto the knot span: s(t) = k₀ + (t / duration)·span.
Each segment therefore gets a share of duration proportional to its knot
length, so with alpha = 1 the traversal is close to constant speed and with
the default alpha = 0.5 it slows through tight turns. Because the mapping is
affine, velocity and acceleration are exact: no derivative-of-the-mapping term
appears.
Sampling outside [0, duration] extrapolates the first or last segment's
cubic (see the module note).
Catmull-Rom spline through every waypoint (§13 "Catmull-Rom spline"), with centripetal knot parameterization by default (
alpha = 0.5).Centripetal parameterization is the default because it is the variant that provably produces no cusps and no self-intersections within a segment, which is what makes a waypoint path safe to hand to a camera or a robot.
alpha = 0gives the classic uniform spline (which can loop near sharp turns) andalpha = 1the chordal one.Construction
Knots are cumulative chord lengths raised to
alpha(k[i+1] = k[i] + |p[i+1] − p[i]|^alpha, floored at 1e-8 so coincident waypoints cannot divide by zero). The two end conditions are reflected virtual points —2·p₀ − p₁before the start and2·pₙ₋₁ − pₙ₋₂after the end — rather than duplicated endpoints, which would produce a zero knot spacing in exactly the formula that divides by it. With two waypoints the reflection makes the spline the straight line between them at constant speed.Each segment is the non-uniform cubic Hermite whose tangents are the Catmull-Rom finite differences
Time mapping
timemaps affinely onto the knot span:s(t) = k₀ + (t / duration)·span. Each segment therefore gets a share ofdurationproportional to its knot length, so withalpha = 1the traversal is close to constant speed and with the defaultalpha = 0.5it slows through tight turns. Because the mapping is affine, velocity and acceleration are exact: no derivative-of-the-mapping term appears.Sampling outside
[0, duration]extrapolates the first or last segment's cubic (see the module note).