inverseTransformRect static method
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) {
// As exposed by `unrelated_type_equality_checks`, this assert was a no-op.
// Fixing it introduces a bunch of runtime failures; for more context see:
// https://github.com/flutter/flutter/pull/31568
// assert(transform.determinant != 0.0);
if (isIdentity(transform)) {
return rect;
}
transform = Matrix4.copy(transform)..invert();
return transformRect(transform, rect);
}