1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use na::{RealField, Unit, UnitQuaternion};
use crate::aliases::{Qua, TVec3};
pub fn quat_exp<N: RealField>(q: &Qua<N>) -> Qua<N> {
q.exp()
}
pub fn quat_log<N: RealField>(q: &Qua<N>) -> Qua<N> {
q.ln()
}
pub fn quat_pow<N: RealField>(q: &Qua<N>, y: N) -> Qua<N> {
q.powf(y)
}
pub fn quat_rotate<N: RealField>(q: &Qua<N>, angle: N, axis: &TVec3<N>) -> Qua<N> {
q * UnitQuaternion::from_axis_angle(&Unit::new_normalize(*axis), angle).into_inner()
}