pub fn sqrt_versor<T>(q: Quaternion<T>) -> Quaternion<T>where
T: Float,
Expand description
Square root of Versor.
If the argument q
is guaranteed to be a Versor,
it is less calculation cost than the sqrt(...)
function.
ยงExamples
let q: Quaternion<f64> = normalize( (1.0, [2.0, 3.0, 4.0]) );
let q_sqrt = sqrt_versor(q);
let result = mul(q_sqrt, q_sqrt);
assert!( (q.0 - result.0).abs() < 1e-12 );
assert!( (q.1[0] - result.1[0]).abs() < 1e-12 );
assert!( (q.1[1] - result.1[1]).abs() < 1e-12 );
assert!( (q.1[2] - result.1[2]).abs() < 1e-12 );