to_rotation_vector

Function to_rotation_vector 

Source
pub fn to_rotation_vector<T>(q: Quaternion<T>) -> Vector3<T>
where T: Float,
Expand description

Converts a Versor into a Rotation Vector.

A Rotation Vector is a convenient representation where:

  1. Its direction defines the rotation axis.
  2. Its norm defines the rotation angle (in radians).

The resulting vector’s norm (the rotation angle) is always constrained to the range: [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 );