Inverse#
-
inline Matrix22 Inverse(const Matrix22 &m, float &det)#
Computes the inverse of a 2x2 matrix.
Calculates the matrix inverse using the analytical formula for 2x2 matrices. If the determinant is close to zero (within FLT_EPSILON), the matrix is considered singular and the original matrix is returned with determinant set to 0.
Note
If the matrix is singular (determinant near zero), the function returns the original matrix and sets det to 0.0f
- Parameters:
m – [in] Matrix to invert
det – [out] Determinant of the input matrix
- Returns:
Inverse matrix if invertible, otherwise the original matrix