IntersectionRects
not ratedReturns the area where the two rects overlap. If the rects doesn't overlap, it returns null.
function IntersectionRects takes rect r1, rect r2 returns rect
local real x1 = RMaxBJ(GetRectMinX(r1), GetRectMinX(r2))
local real x2 = RMinBJ(GetRectMaxX(r1), GetRectMaxX(r2))
local real y1 = RMaxBJ(GetRectMinY(r1), GetRectMinY(r2))
local real y2 = RMinBJ(GetRectMaxY(r1), GetRectMaxY(r2))
if ( x1 > x2 ) or ( y1 > y2 ) then
return null
endif
return Rect(x1, x2, y1, y2)
endfunctionNo comments.