use na::{Real, U3, UnitQuaternion, Unit}; use aliases::{Vec, Qua}; /// Computes the quaternion exponential. pub fn quat_exp(q: &Qua) -> Qua { q.exp() } /// Computes the quaternion logarithm. pub fn quat_log(q: &Qua) -> Qua { q.ln() } /// Raises the quaternion `q` to the power `y`. pub fn quat_pow(q: &Qua, y: N) -> Qua { q.powf(y) } /// Builds a quaternion from an axis and an angle, and right-multiply it to the quaternion `q`. pub fn quat_rotate(q: &Qua, angle: N, axis: &Vec) -> Qua { q * UnitQuaternion::from_axis_angle(&Unit::new_normalize(*axis), angle).unwrap() } //pub fn quat_sqrt(q: &Qua) -> Qua { // unimplemented!() //}