1

I have a number of rectangles overlapping (side by side is counted as overlap). represented by the following data structure:

rect = [{x, y, width, height, rectNumber}, {...}, ...];

My question is what is the logic (or pseudo-code) to convert my rectangles datas to the vertices forming the outlines of the final rectilinear polygon. I'm saying outlines with an s because my final shape can have holes so inner-outlines.

The following example shows the overlapping rectangles and the result wanted with the vertices in green and the outlines in red.

example of overlapping rectangles and its outlines

I've found this post ( Finding common outline of multiple polygons) but didn't really understood everything also my question is I think a tiny bit different.

Thanks in advance,

Community
  • 1
  • 1
JSmith
  • 4,519
  • 4
  • 29
  • 45
  • 1
    These two papers seem to address your exact problem: [Finding the contour of a union of iso-oriented rectangles](http://www.dtic.mil/dtic/tr/fulltext/u2/a084959.pdf), [Planar union of rectangles with sides parallel to the coordinate axis](http://icai.ektf.hu/pdf/ICAI2004-vol1-pp293-301.pdf). – Nico Schertler Jul 26 '18 at 20:33
  • very useful, I'm reading the second one as it seems more easy. what would be great would be someone writing a pseudo code or explain as answer. thanks again – JSmith Jul 26 '18 at 20:52
  • @NicoSchertler I've read most of the two papers you've sended me without any success of clearly understanding how the whole process works. If you could explain to me one of it I would be very grateful. Thanks in advance – JSmith Jul 29 '18 at 17:34

0 Answers0