Say you have a bunch of rectangles like these:
They get organized into 3 distinct final shapes like this:
As you can see, there are a few "complete contours", as in here:
The way you figure out the contour of the thing is by visually going around the edge of the final shape, sort of like this:
The question is, given that you start with a set of arbitrarily sized curves, in this case, rectangles (assume they were drawn as real rectangles), how to efficiently/effectively figure out what the final paths are on the final set of shapes. So in the pink drawing, there are 4 paths that define the whole system. I am having a hard time imagining how you would formulate this as perhaps a graph theory problem or something in order to iterate through a list of rectangles, determine their "connectivity", then create some sort of mental sketch of the "perimeter". It seems like it would get complicated fast.
Wondering if there are any areas of research that delve into this stuff, or if there is a straightforward solution to the problem.