MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / getInverse

Method getInverse

src/mathematics/Matrix2x2.cpp:32–43  ·  view source on GitHub ↗

Return the inverse matrix

Source from the content-addressed store, hash-verified

30
31// Return the inverse matrix
32Matrix2x2 Matrix2x2::getInverse(decimal determinant) const {
33
34 // Check if the determinant is equal to zero
35 assert(std::abs(determinant) > MACHINE_EPSILON);
36
37 decimal invDeterminant = decimal(1.0) / determinant;
38
39 Matrix2x2 tempMatrix(mRows[1][1], -mRows[0][1], -mRows[1][0], mRows[0][0]);
40
41 // Return the inverse matrix
42 return (invDeterminant * tempMatrix);
43}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected