use na::{self, Real, Unit}; use aliases::Qua; /// The conjugate of `q`. pub fn conjugate(q: &Qua) -> Qua { q.conjugate() } /// The inverse of `q`. pub fn inverse(q: &Qua) -> Qua { q.try_inverse().unwrap_or(na::zero()) } //pub fn isinf(x: &Qua) -> Vec { // x.coords.map(|e| e.is_inf()) //} //pub fn isnan(x: &Qua) -> Vec { // x.coords.map(|e| e.is_nan()) //} /// Interpolate linearly between `x` and `y`. pub fn lerp(x: &Qua, y: &Qua, a: N) -> Qua { x.lerp(y, a) } //pub fn mix(x: &Qua, y: &Qua, a: N) -> Qua { // x * (N::one() - a) + y * a //} /// Interpolate spherically between `x` and `y`. pub fn slerp(x: &Qua, y: &Qua, a: N) -> Qua { Unit::new_normalize(*x).slerp(&Unit::new_normalize(*y), a).unwrap() }