# copyInverse method

double copyInverse(
1. Matrix4 arg
)

Set this matrix to be the inverse of `arg`

## Implementation

``````double copyInverse(Matrix4 arg) {
final argStorage = arg._m4storage;
final a00 = argStorage[0];
final a01 = argStorage[1];
final a02 = argStorage[2];
final a03 = argStorage[3];
final a10 = argStorage[4];
final a11 = argStorage[5];
final a12 = argStorage[6];
final a13 = argStorage[7];
final a20 = argStorage[8];
final a21 = argStorage[9];
final a22 = argStorage[10];
final a23 = argStorage[11];
final a30 = argStorage[12];
final a31 = argStorage[13];
final a32 = argStorage[14];
final a33 = argStorage[15];
final b00 = a00 * a11 - a01 * a10;
final b01 = a00 * a12 - a02 * a10;
final b02 = a00 * a13 - a03 * a10;
final b03 = a01 * a12 - a02 * a11;
final b04 = a01 * a13 - a03 * a11;
final b05 = a02 * a13 - a03 * a12;
final b06 = a20 * a31 - a21 * a30;
final b07 = a20 * a32 - a22 * a30;
final b08 = a20 * a33 - a23 * a30;
final b09 = a21 * a32 - a22 * a31;
final b10 = a21 * a33 - a23 * a31;
final b11 = a22 * a33 - a23 * a32;
final det =
b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
if (det == 0.0) {
setFrom(arg);
return 0.0;
}
final invDet = 1.0 / det;
_m4storage[0] = (a11 * b11 - a12 * b10 + a13 * b09) * invDet;
_m4storage[1] = (-a01 * b11 + a02 * b10 - a03 * b09) * invDet;
_m4storage[2] = (a31 * b05 - a32 * b04 + a33 * b03) * invDet;
_m4storage[3] = (-a21 * b05 + a22 * b04 - a23 * b03) * invDet;
_m4storage[4] = (-a10 * b11 + a12 * b08 - a13 * b07) * invDet;
_m4storage[5] = (a00 * b11 - a02 * b08 + a03 * b07) * invDet;
_m4storage[6] = (-a30 * b05 + a32 * b02 - a33 * b01) * invDet;
_m4storage[7] = (a20 * b05 - a22 * b02 + a23 * b01) * invDet;
_m4storage[8] = (a10 * b10 - a11 * b08 + a13 * b06) * invDet;
_m4storage[9] = (-a00 * b10 + a01 * b08 - a03 * b06) * invDet;
_m4storage[10] = (a30 * b04 - a31 * b02 + a33 * b00) * invDet;
_m4storage[11] = (-a20 * b04 + a21 * b02 - a23 * b00) * invDet;
_m4storage[12] = (-a10 * b09 + a11 * b07 - a12 * b06) * invDet;
_m4storage[13] = (a00 * b09 - a01 * b07 + a02 * b06) * invDet;
_m4storage[14] = (-a30 * b03 + a31 * b01 - a32 * b00) * invDet;
_m4storage[15] = (a20 * b03 - a21 * b01 + a22 * b00) * invDet;
return det;
}``````