copyInverse method
- Matrix2 arg
Set this matrix to be the inverse of arg
Implementation
double copyInverse(Matrix2 arg) {
final det = arg.determinant();
if (det == 0.0) {
setFrom(arg);
return 0.0;
}
final invDet = 1.0 / det;
final argStorage = arg._m2storage;
_m2storage[0] = argStorage[3] * invDet;
_m2storage[1] = -argStorage[1] * invDet;
_m2storage[2] = -argStorage[2] * invDet;
_m2storage[3] = argStorage[0] * invDet;
return det;
}