use na::{Unit, UnitQuaternion}; use crate::aliases::{Qua, TVec3}; use crate::RealNumber; /// 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: T) -> 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: T, axis: &TVec3) -> Qua { q * UnitQuaternion::from_axis_angle(&Unit::new_normalize(*axis), angle).into_inner() } //pub fn quat_sqrt(q: &Qua) -> Qua { // unimplemented!() //}