Function quaternion_core::to_rotation_vector
source · [−]pub fn to_rotation_vector<T>(q: Quaternion<T>) -> Vector3<T> where
T: Float,
Expand description
Convert Versor to Rotation vector.
The Rotation vector itself represents the axis of rotation, and the norm represents the angle of rotation around the axis.
Range of the norm of the rotation vector: [0, 2π]
Example
let angle = PI / 2.0;
let axis = [1.0, 0.0, 0.0];
// These represent the same rotation.
let rv = scale(angle, axis); // Rotation vector
let q = from_axis_angle(axis, angle); // Quaternion
// Quaternion ---> Rotation vector
let q2rv = to_rotation_vector(q);
assert!( (rv[0] - q2rv[0]).abs() < 1e-12 );
assert!( (rv[1] - q2rv[1]).abs() < 1e-12 );
assert!( (rv[2] - q2rv[2]).abs() < 1e-12 );