Simple 3×3 matrix inverse code (C++)
Here’s a version of batty’s answer, but this computes the correct inverse. batty’s version computes the transpose of the inverse. // computes the inverse of a matrix m double det = m(0, 0) * (m(1, 1) * m(2, 2) – m(2, 1) * m(1, 2)) – m(0, 1) * (m(1, 0) * m(2, 2) – … Read more