[go: up one dir, main page]

ultraviolet 0.1.3

A crate to do linear algebra, fast.
Documentation
use wide::f32x4;

use crate::vec::*;

pub trait Lerp<T> {
    fn lerp(&self, end: Self, t: T) -> Self;
}

macro_rules! impl_lerp {
    ($($tt:ident => ($($vt:ident),+)),+) => {
        $($(impl Lerp<$tt> for $vt {
            #[inline]
            fn lerp(&self, end: Self, t: $tt) -> Self {
                *self * ($tt::from(1.0) - t) + end * t
            }
        })+)+
    };
}

impl_lerp!(f32 => (Vec2, Vec3), f32x4 => (Wec2, Wec3));