splerp

fun splerp(t: Double, p0: Double, p1: Double, p2: Double, p3: Double): Double(source)

Performs Catmull-Rom spline interpolation between two points.

This function implements cubic spline interpolation using the Catmull-Rom formulation, which provides smooth curves through control points with continuous first derivatives.

Return

the interpolated value at parameter \(t\)

Parameters

t

interpolation factor, in the range \(0, 1\) where:

  • \(t = 0\) returns \(p_1\)

  • \(t = 1\) returns \(p_2\)

p0

the first control point (used for computing tangent at p1)

p1

the start point of the interpolation segment

p2

the end point of the interpolation segment

p3

the fourth control point (used for computing tangent at p2)