public boolean invert ( ) { double determinant = determinant ( ) ; if ( Math . abs ( determinant ) <= Double . MIN_VALUE ) { return false ; } double t00 = m00 ; double t01 = m01 ; double t02 = m02 ; double t10 = m10 ; double t11 = m11 ; double t12 = m12 ; m00 = t11 / determinant ; m10 = - t10 / determinant ; m01 = - t01 / determinant ; m11 = t00 / determinant ; m02 = ( t01 * t12 - t11 * t02 ) / determinant ; m12 = ( t10 * t02 - t00 * t12 ) / determinant ; return true ; }
Invert this matrix . Implementation stolen from OpenJDK .