Get the points of intersection from 2 rectangles
If the input rectangles are normalized, i.e. you already know that x1 < x2, y1 < y2 (and the same for the second rectangle), then all you need to do is calculate int x5 = max(x1, x3); int y5 = max(y1, y3); int x6 = min(x2, x4); int y6 = min(y2, y4); and it will … Read more