- override
Computes the intersection of this
and other
.
The intersection of two axis-aligned rectangles, if any, is always another axis-aligned rectangle.
Returns the intersection of this and other
, or null
if they don't
intersect.
Source
@override Rectangle<T> intersection(math.Rectangle<T> rect) { T rLeft = max(left, rect.left); T rTop = max(top, rect.top); T rRight = min(right, rect.right); T rBottom = min(bottom, rect.bottom); return new Rectangle<T>(rLeft, rTop, rRight - rLeft, rBottom - rTop); }