Function matrix_product

Source
pub fn matrix_product<T>(m: DCM<T>, v: Vector3<T>) -> Vector3<T>
where T: Float,
Expand description

Product of DCM and Vector3

This is the product of a 3x3 matrix and a 3D vector. It is used to apply the rotation represented by the DCM to the vector.

ยงExamples

let theta = PI / 2.0;
let rot_x = [
    [1.0, 0.0, 0.0],
    [0.0, theta.cos(), -theta.sin()],
    [0.0, theta.sin(),  theta.cos()]
];
let v = [0.0, 1.0, 0.0];
 
let r = matrix_product(rot_x, v);
assert!( (r[0] - 0.0).abs() < 1e-12 );
assert!( (r[1] - 0.0).abs() < 1e-12 );
assert!( (r[2] - 1.0).abs() < 1e-12 );