Function from_rotation_vector

Source
pub fn from_rotation_vector<T>(r: 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 [rad] of rotation around the axis.

Maximum range of the norm of the rotation vector: [0, 2pi]

ยงExamples

let angle = PI / 2.0;
let axis = [1.0, 0.0, 0.0];
 
// This represents a rotation of pi/2 around the x-axis.
let rot_vec = scale(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 );