copyInverse method
Set this matrix to be the inverse of arg
Implementation
double copyInverse(Matrix3 arg) {
final double det = arg.determinant();
if (det == 0.0) {
setFrom(arg);
return 0.0;
}
final double invDet = 1.0 / det;
final Float32List argStorage = arg._m3storage;
final double ix = invDet *
(argStorage[4] * argStorage[8] - argStorage[5] * argStorage[7]);
final double iy = invDet *
(argStorage[2] * argStorage[7] - argStorage[1] * argStorage[8]);
final double iz = invDet *
(argStorage[1] * argStorage[5] - argStorage[2] * argStorage[4]);
final double jx = invDet *
(argStorage[5] * argStorage[6] - argStorage[3] * argStorage[8]);
final double jy = invDet *
(argStorage[0] * argStorage[8] - argStorage[2] * argStorage[6]);
final double jz = invDet *
(argStorage[2] * argStorage[3] - argStorage[0] * argStorage[5]);
final double kx = invDet *
(argStorage[3] * argStorage[7] - argStorage[4] * argStorage[6]);
final double ky = invDet *
(argStorage[1] * argStorage[6] - argStorage[0] * argStorage[7]);
final double kz = invDet *
(argStorage[0] * argStorage[4] - argStorage[1] * argStorage[3]);
_m3storage[0] = ix;
_m3storage[1] = iy;
_m3storage[2] = iz;
_m3storage[3] = jx;
_m3storage[4] = jy;
_m3storage[5] = jz;
_m3storage[6] = kx;
_m3storage[7] = ky;
_m3storage[8] = kz;
return det;
}