iRectangle2D combine(ref iRectangle2D other) { iRectangle2D combined = new iRectangle2D(); iPoint2D br1 = getBottomRight(); iPoint2D br2 = other.getBottomRight(); combined.setAbsolute(Math.Min(pos.x, other.pos.x), Math.Min(pos.y, other.pos.y), Math.Max(br1.x, br2.x), Math.Max(br2.y, br2.y)); return(combined); }
iRectangle2D getOverlap(ref iRectangle2D other) { iRectangle2D overlap = new iRectangle2D(); iPoint2D br1 = getBottomRight(); iPoint2D br2 = other.getBottomRight(); overlap.setAbsolute(Math.Max(pos.x, other.pos.x), Math.Max(pos.y, other.pos.y), Math.Min(br1.x, br2.x), Math.Min(br1.y, br2.y)); return(overlap); }