Skip to main content

VectorArithmetic

Trait VectorArithmetic 

Source
pub trait VectorArithmetic:
    Clone
    + Default
    + Send
    + 'static
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<f64, Output = Self> {
    // Provided method
    fn lerp(&self, other: &Self, t: f64) -> Self { ... }
}
Expand description

Types that can be linearly interpolated.

The native animation system uses this to interpolate between values. Any type implementing Add, Sub, and Mul<f64> automatically gets this trait.

Provided Methods§

Source

fn lerp(&self, other: &Self, t: f64) -> Self

Linear interpolation: self + (other - self) * t

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> VectorArithmetic for T
where T: Clone + Default + Send + 'static + Add<Output = T> + Sub<Output = T> + Mul<f64, Output = T>,