inverseTransformRect method

Rect inverseTransformRect (Matrix4 transform, Rect rect)

Returns a rect that bounds the result of applying the inverse of the given matrix as a perspective transform to the given rect.

This function assumes the given rect is in the plane with z equals 0.0. The transformed rect is then projected back into the plane with z equals 0.0 before computing its bounding rect.

Implementation

static Rect inverseTransformRect(Matrix4 transform, Rect rect) {
  assert(rect != null);
  assert(transform.determinant != 0.0);
  if (isIdentity(transform))
    return rect;
  transform = Matrix4.copy(transform)..invert();
  return transformRect(transform, rect);
}