Consider the 3 rectangles stored as 2 opposing corners.
$ r_1 = (0,0,2,1)$ , $ r_2 = (1,1,2,2)$ , $ r_3 = (2,0,3,1)$
The area covered by these 3 rectangles can be represented using 2 rectangles
$ r_4 = (0,0,3,1)$, $ r_5 = (1,1,2,2) $
Is there algorithm that can take in a list of smaller rectangles and consolidate them into larger rectangles that cover the same area? (the goal is to minimise the number of rectangles being stored)
harder example:
small rects: $ r_1 = (0,0,2,2)$ , $ r_2 = (0,2,1,4)$ , $ r_3 = (1,2,2,3)$
potential solution: $ r_4 = (0,0,2,3)$ , $ r_5 = (0,3,1,4)$
This one is more complicated because there is no trivial merges where the edges of 2 rectangles are 'perfectly adjacent'(i dont know the proper terminology) ie. the edge 2,0,2,1 in the first example is common to $r_1$ and $r_3$
I think section 6 of this paper has a pretty good solution to my problem. I think this question can be closed. https://pdfs.semanticscholar.org/d4ee/f45c3e96a7df047c43e5b1c25b62898aec01.pdf