[−][src]Function minterpolate::spherical_linear_interpolate
pub fn spherical_linear_interpolate<T>(
input: f32,
inputs: &[f32],
outputs: &[T],
normalize: bool
) -> T where
T: InterpolationPrimitive + Clone,
Do spherical linear interpolation.
f(t) = sin((1 - d) * a) / sin (a) * p0 + sin(d * a) / sin (a) * p1
d = (t - t0) / (t1 - t0)
a = acos(p0 . p1)
p0 = output at left keyframe
p1 = output at right keyframe
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 spherical linear interpolation this should be the same size asinputs
normalize
: if true, normalize the interpolated value before returning it