[−][src]Function minterpolate::catmull_rom_spline_interpolate
pub fn catmull_rom_spline_interpolate<T>(
input: f32,
inputs: &[f32],
outputs: &[T],
normalize: bool
) -> T where
T: InterpolationPrimitive + Clone,
Catmull-Rom spline interpolation
f(t) = (2d^3 + 3d^2 + 1)p0 + (d^3 - 2d^2 + d)m0 + (-2d^3 + 3d^2)p1 + (d^3 - d^2)m1
d = (t - t0) / (t1 - t0)
p0 = position at left keyframe
p1 = position at right keyframe
k = left keyframe index
k+1 = right keyframe index
m0 = (p_k+1 - p_k-1) / (t_k+1 - t_k-1)
m1 = (p_k+2 - p_k) / (t_k+2 - t_k)
t0 = input at left keyframe
t1 = input at right keyframe
Parameters:
input
: the input value to the functioninputs
: list of discrete input values for each keyframeoutputs
: list of output values to interpolate between, for catmull rom spline interpolation this should be the size ofinputs
+ 2[ in_tangent_0, position_0, position_1, .., position_n, out_tangent_n ]
normalize
: if true, normalize the interpolated value before returning it