Trait bspline::Interpolate
source · [−]pub trait Interpolate<F> {
fn interpolate(&self, other: &Self, t: F) -> Self;
}
Expand description
The interpolate trait is used to linearly interpolate between two types (or in the case of Quaternions, spherically linearly interpolate). The B-spline curve uses this trait to compute points on the curve for the given parameter value.
A default implementation of this trait is provided for all T
that are `Mul<f32, Output = T>
- Add<Output = T> + Copy` as these are the only operations needed to linearly interpolate the values. Any type implementing this trait should perform whatever the appropriate linear interpolaton is for the type.
Required methods
fn interpolate(&self, other: &Self, t: F) -> Self
fn interpolate(&self, other: &Self, t: F) -> Self
Linearly interpolate between self
and other
using t
, for example with floats:
self * (1.0 - t) + other * t
If the result returned is not a correct linear interpolation of the values the curve produced using the value may not be correct.