BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Matrix3.invert()

The Matrix3.invert() method in the Three.js library is used to compute the inverse of a 3x3 matrix.

Syntax

.matrix3.invert()

Parameters

This method does not take any parameters.

Return Value

The Matrix3.invert() method returns the inverse of the matrix as a new Matrix3 object.

Description

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.

Example

// 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);

Remarks

  • 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.