copyInverse method

double copyInverse (Matrix2 arg)

Set this matrix to be the inverse of arg

Implementation

double copyInverse(Matrix2 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._m2storage;
  _m2storage[0] = argStorage[3] * invDet;
  _m2storage[1] = -argStorage[1] * invDet;
  _m2storage[2] = -argStorage[2] * invDet;
  _m2storage[3] = argStorage[0] * invDet;
  return det;
}