I want to find the polygon of n overlapping rectangles

44 Views Asked by At

Having n Rectangles (x1,y1,x2,y2) in each group, I need to find the polygon that contains all of them for each group.

Also, I need to detect if a group of rectangles has one or more rectangles that do not touch any other rectangle.

group 1

103 59  321 162
241 178 308 183
259 103 523 359
281 169 577 198

group 2

98  7   386 129
143 281 399 406
196 97  392 355
254 181 519 382

I don't know the best approach to solve it programmatically. I fell comfortable using C#.

The number of groups does not matter, because the solution to solve one group will be applied n times.