Skip to content

Documentation / @ripl/3d / mat4Invert

Function: mat4Invert() ​

mat4Invert(m): Matrix4 | null

Defined in: 3d/src/math/matrix.ts:244

Inverts a 4×4 matrix, or returns null when it is singular.

Mirrors the matrixInvert contract from @ripl/core's 2D matrix module: a matrix with a zero determinant has no inverse, and null says so rather than propagating Infinity through every downstream coordinate.

Parameters ​

ParameterTypeDescription
mMatrix4The matrix to invert.

Returns ​

Matrix4 | null

The inverse, or null if m is singular.