tryInvert method

Matrix4 tryInvert (Matrix4 other)

Returns a matrix that is the inverse of other if other is invertible, otherwise null.

Implementation

static Matrix4 tryInvert(Matrix4 other) {
  final Matrix4 r = new Matrix4.zero();
  final double determinant = r.copyInverse(other);
  if (determinant == 0.0) {
    return null;
  }
  return r;
}