pub trait Interpolate<T>: Sized + Copy {
// Required methods
fn lerp(a: Self, b: Self, t: T) -> Self;
fn quadratic_bezier(a: Self, u: Self, b: Self, t: T) -> Self;
fn cubic_bezier(a: Self, u: Self, v: Self, b: Self, t: T) -> Self;
// Provided method
fn cubic_hermite(
_: (Self, T),
a: (Self, T),
b: (Self, T),
_: (Self, T),
t: T,
) -> Self { ... }
}Expand description
Keys that can be interpolated in between. Implementing this trait is required to perform sampling on splines.
T is the variable used to sample with. Typical implementations use [f32] or [f64], but
you’re free to use the ones you like. Feel free to have a look at Spline::sample for
instance to know which trait your type must implement to be usable.
Required Methods§
Sourcefn quadratic_bezier(a: Self, u: Self, b: Self, t: T) -> Self
fn quadratic_bezier(a: Self, u: Self, b: Self, t: T) -> Self
Quadratic Bézier interpolation.
Sourcefn cubic_bezier(a: Self, u: Self, v: Self, b: Self, t: T) -> Self
fn cubic_bezier(a: Self, u: Self, v: Self, b: Self, t: T) -> Self
Cubic Bézier interpolation.
Provided Methods§
Sourcefn cubic_hermite(
_: (Self, T),
a: (Self, T),
b: (Self, T),
_: (Self, T),
t: T,
) -> Self
fn cubic_hermite( _: (Self, T), a: (Self, T), b: (Self, T), _: (Self, T), t: T, ) -> Self
Cubic hermite interpolation.
Default to lerp.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.