Function minterpolate::spherical_linear_interpolate [] [src]

pub fn spherical_linear_interpolate<T>(
    input: f32,
    inputs: &[f32],
    outputs: &[T],
    normalize: bool
) -> T where
    T: InterpolationPrimitive + Copy

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 function
  • inputs: list of discrete input values for each keyframe
  • outputs: list of output values to interpolate between, for spherical linear interpolation this should be the same size as inputs
  • normalize: if true, normalize the interpolated value before returning it