pub fn from_rotation_vector<T>(v: Vector3<T>) -> Quaternion<T> where
    T: Float
Expand description

Convert Rotation vector to Versor.

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];
 
// This represents a rotation of π/2 around the x-axis.
let rot_vec = scale_vec(angle, axis);  // Rotation vector
 
// Rotation vector ---> Quaternion
let q = from_rotation_vector(rot_vec);
 
let r = point_rotation(q, [1.0, 1.0, 0.0]);
 
assert!( (r[0] - 1.0).abs() < 1e-12 );
assert!( (r[1] - 0.0).abs() < 1e-12 );
assert!( (r[2] - 1.0).abs() < 1e-12 );