use na::{self, Real, Unit, U4}; use aliases::{Vec, Qua}; pub fn conjugate(q: &Qua) -> Qua { q.conjugate() } 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()) //} 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 } pub fn slerp(x: &Qua, y: &Qua, a: N) -> Qua { Unit::new_normalize(*x).slerp(&Unit::new_normalize(*y), a).unwrap() }