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