Function 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.

Norm range of the calculation result: [0, pi]

ยงExamples

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 );