Spline
The spline curve entity is a nonuniform cubic spline, defined by a series of three-dimensional points, tangent vectors at each point, and an array of unnormalized spline parameters at each point.
Data Format:
par_arr[] Array of spline parameters
(t) at each point.
pnt_arr[][3] Array of spline interpolant points
tan_arr[][3] Array of tangent vectors at
each point
Parameterization:
x, y, and z are a series of unique cubic functions, one per segment, fully determined by the starting and ending points, and tangents of each segment.
Let p_min be the parameter of the first spline point, and p_max be the parameter of the last spline point. Then, t', the unnormalized parameter, is t * p_max + (1-t) * p_min.
Locate the ith spline segment such that:
par_arr[i] < t' < par_arr[i+1]
(If t < 0 or t > +1, use the first or last segment.)
t0 = (t' - par_arr[i]) / (par_arr[i+1] - par_arr[i])
t1 = (par_arr[i+1] - t') / (par_arr[i+1] - par_arr[i])
The coordinates of the points are then:
(x, y, z) = pnt_arr[i] * t1^2 * (1 + 2 * t0) +
pnt_arr[i+1] * t0^2 * (1 + 2 * t1) +
(par_arr[i+1] - par_arr[i]) * t0 * t1 *
(tan_arr[i] * t1 - tan_arr[i+1] * t0)