Trait ultraviolet::interp::Lerp

source ·
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§

source

fn lerp(&self, end: Self, t: T) -> Self

Implementations on Foreign Types§

source§

impl Lerp<f64> for f64

source§

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.

source§

impl Lerp<f32> for f32

source§

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.

Implementors§

source§

impl Lerp<f32> for Bivec2

source§

impl Lerp<f32> for Bivec3

source§

impl Lerp<f32> for Rotor2

source§

impl Lerp<f32> for Rotor3

source§

impl Lerp<f32> for Vec2

source§

impl Lerp<f32> for Vec3

source§

impl Lerp<f32> for Vec4

source§

impl Lerp<f64> for DBivec2

source§

impl Lerp<f64> for DBivec3

source§

impl Lerp<f64> for DRotor2

source§

impl Lerp<f64> for DRotor3

source§

impl Lerp<f64> for DVec2

source§

impl Lerp<f64> for DVec3

source§

impl Lerp<f64> for DVec4

source§

impl Lerp<f32x4> for Bivec2x4

source§

impl Lerp<f32x4> for Bivec3x4

source§

impl Lerp<f32x4> for Rotor2x4

source§

impl Lerp<f32x4> for Rotor3x4

source§

impl Lerp<f32x4> for f32x4

source§

impl Lerp<f32x4> for Vec2x4

source§

impl Lerp<f32x4> for Vec3x4

source§

impl Lerp<f32x4> for Vec4x4

source§

impl Lerp<f32x8> for Bivec2x8

source§

impl Lerp<f32x8> for Bivec3x8

source§

impl Lerp<f32x8> for Rotor2x8

source§

impl Lerp<f32x8> for Rotor3x8

source§

impl Lerp<f32x8> for f32x8

source§

impl Lerp<f32x8> for Vec2x8

source§

impl Lerp<f32x8> for Vec3x8

source§

impl Lerp<f32x8> for Vec4x8

source§

impl Lerp<f64x2> for DBivec2x2

source§

impl Lerp<f64x2> for DBivec3x2

source§

impl Lerp<f64x2> for DRotor2x2

source§

impl Lerp<f64x2> for DRotor3x2

source§

impl Lerp<f64x2> for f64x2

source§

impl Lerp<f64x2> for DVec2x2

source§

impl Lerp<f64x2> for DVec3x2

source§

impl Lerp<f64x2> for DVec4x2

source§

impl Lerp<f64x4> for DBivec2x4

source§

impl Lerp<f64x4> for DBivec3x4

source§

impl Lerp<f64x4> for DRotor2x4

source§

impl Lerp<f64x4> for DRotor3x4

source§

impl Lerp<f64x4> for f64x4

source§

impl Lerp<f64x4> for DVec2x4

source§

impl Lerp<f64x4> for DVec3x4

source§

impl Lerp<f64x4> for DVec4x4