Type Definition munum::Mat2

source · []
pub type Mat2<T = f32> = Matrix<T, 2, 2>;
Expand description

A 2x2 matrix

Implementations

Calculates the determinant of this matrix.

Examples
let m = Mat2::<i32>::from_slice(&[1, 2, 3, 4]);
assert_eq!(m.det(), -2);

Invert this matrix. If this matrix is not invertible, this method returns false and the matrix is unchanged.

Examples
let mut m = <Mat2>::from_slice(&[1., 2., 3., 4.]);
assert!(m.invert());
assert_eq!(*m.as_ref(), [-2., 1., 1.5, -0.5]);