use na::{self, Real, Unit}; use crate::aliases::Qua; /// The conjugate of `q`. pub fn quat_conjugate(q: &Qua) -> Qua { q.conjugate() } /// The inverse of `q`. pub fn quat_inverse(q: &Qua) -> Qua { q.try_inverse().unwrap_or_else(na::zero) } //pub fn quat_isinf(x: &Qua) -> TVec { // x.coords.map(|e| e.is_inf()) //} //pub fn quat_isnan(x: &Qua) -> TVec { // x.coords.map(|e| e.is_nan()) //} /// Interpolate linearly between `x` and `y`. pub fn quat_lerp(x: &Qua, y: &Qua, a: N) -> Qua { x.lerp(y, a) } //pub fn quat_mix(x: &Qua, y: &Qua, a: N) -> Qua { // x * (N::one() - a) + y * a //} /// Interpolate spherically between `x` and `y`. pub fn quat_slerp(x: &Qua, y: &Qua, a: N) -> Qua { Unit::new_normalize(*x) .slerp(&Unit::new_normalize(*y), a) .into_inner() }