intersect method
Intersection of two rectangles.
Implementation
Rect intersect(Rect other) {
final ix0 = math.max(x0, other.x0);
final iy0 = math.max(y0, other.y0);
final ix1 = math.min(x1, other.x1);
final iy1 = math.min(y1, other.y1);
if (ix0 >= ix1 || iy0 >= iy1) return Rect.empty;
return Rect(ix0, iy0, ix1, iy1);
}