use std::ops::{Add, Sub};
use raw::RawFrom;
pub trait Lerp<T> {
fn lerp (a: Self, b: Self, t: T) -> Self;
}
impl<N> Lerp<f32> for N
where N: Copy + Add<Output = N> + Sub<Output = N> + RawFrom<f32>,
f32: RawFrom<N>
{
fn lerp (a: N, b: N, t: f32) -> N { a + N::raw_from(f32::raw_from(b - a) * t) }
}
impl<N> Lerp<f64> for N
where N: Copy + Add<Output = N> + Sub<Output = N> + RawFrom<f64>,
f64: RawFrom<N>
{
fn lerp (a: N, b: N, t: f64) -> N { a + N::raw_from(f64::raw_from(b - a) * t) }
}