pub trait Lerp<T> {
// Required method
fn lerp(&self, end: Self, t: T) -> Self;
}Expand description
Pure linear interpolation, i.e. (1.0 - t) * self + (t) * end.
For interpolating Rotors with linear interpolation, you almost certainly
want to normalize the returned Rotor. For example,
let interpolated_rotor = rotor1.lerp(rotor2, 0.5).normalized();For most cases (especially where performance is the primary concern, like in
animation interpolation for games, this ‘normalized lerp’ or ‘nlerp’ is probably
what you want to use. However, there are situations in which you really want
the interpolation between two Rotors to be of constant angular velocity. In this
case, check out Slerp.
Required Methods§
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.
Implementations on Foreign Types§
Source§impl Lerp<f32> for f32
impl Lerp<f32> for f32
Source§fn lerp(&self, end: Self, t: f32) -> Self
fn lerp(&self, end: Self, t: f32) -> Self
Linearly interpolate between self and end by t between 0.0 and 1.0.
i.e. (1.0 - t) * self + (t) * end.
For interpolating Rotors with linear interpolation, you almost certainly
want to normalize the returned Rotor. For example,
let interpolated_rotor = rotor1.lerp(rotor2, 0.5).normalized();For most cases (especially where performance is the primary concern, like in
animation interpolation for games, this ‘normalized lerp’ or ‘nlerp’ is probably
what you want to use. However, there are situations in which you really want
the interpolation between two Rotors to be of constant angular velocity. In this
case, check out Slerp.
Source§impl Lerp<f64> for f64
impl Lerp<f64> for f64
Source§fn lerp(&self, end: Self, t: f64) -> Self
fn lerp(&self, end: Self, t: f64) -> Self
Linearly interpolate between self and end by t between 0.0 and 1.0.
i.e. (1.0 - t) * self + (t) * end.
For interpolating Rotors with linear interpolation, you almost certainly
want to normalize the returned Rotor. For example,
let interpolated_rotor = rotor1.lerp(rotor2, 0.5).normalized();For most cases (especially where performance is the primary concern, like in
animation interpolation for games, this ‘normalized lerp’ or ‘nlerp’ is probably
what you want to use. However, there are situations in which you really want
the interpolation between two Rotors to be of constant angular velocity. In this
case, check out Slerp.