Skip to content

cf_m4_invert

Category: math
GitHub: cute_math3d.h


Returns the inverse of a matrix.

CF_M4x4 cf_m4_invert(CF_M4x4 a)
Parameters Description
a The matrix to invert.

Return Value

Returns the inverse, or the identity matrix if a is singular.

Remarks

This is a general 4x4 inverse. If the matrix is a rigid transform (rotation plus translation with no scale), transposing the upper 3x3 and negating the translation is considerably cheaper.

CF_M4x4
cf_m4_transpose
cf_m4_normal_matrix
cf_mul