The Matrix3.invert()
method in the Three.js library is used to compute the inverse of a 3x3 matrix.
.matrix3.invert()
This method does not take any parameters.
The Matrix3.invert()
method returns the inverse of the matrix as a new Matrix3
object.
The Matrix3.invert()
method calculates the inverse of a 3x3 matrix. If the matrix is not invertible, then the method will return a null
object. The method uses the Gauss-Jordan elimination algorithm to compute the inverse of the matrix.
// create a 3x3 matrix
const matrix = new THREE.Matrix3().set(
1, 2, 3,
4, 5, 6,
7, 8, 9
);
// invert the matrix
const inverseMatrix = matrix.invert();
// output the inverse matrix
console.log(inverseMatrix);
The Matrix3.invert()
method does not change the original matrix.
The method can be used to compute the inverse of a matrix for operations such as transformations, rotations or scaling.
Three.js also provides a Matrix4.invert()
method that can be used to compute the inverse of a 4x4 matrix.
The Matrix3.invert()
method can be used to solve a system of linear equations represented by a 3x3 matrix.