use na::{Real, U3, Unit, UnitQuaternion, Vector3}; use aliases::{Vec, Qua}; pub fn angle(x: &Qua) -> N { UnitQuaternion::from_quaternion(*x).angle() } pub fn angleAxis(angle: N, axis: &Vec) -> Qua { UnitQuaternion::from_axis_angle(&Unit::new_normalize(*axis), angle).unwrap() } pub fn axis(x: &Qua) -> Vec { if let Some(a) = UnitQuaternion::from_quaternion(*x).axis() { a.unwrap() } else { Vector3::zeros() } }