Re: Finding lines surrounding set of rectangles



On Jul 3, 4:47 pm, Gert Vierman <gert.vie...@xxxxxxxxx> wrote:
Hello,

Can anybody point me to an algorithm to find the set of lines which
circumvent a set of rectangles, which are optionally adjacent ? A small
picture to explain :

 http://zevv.nl/div/lijntjes.png

The input of the algorithm I'm looking for consists of the coordinates
of the three blue rectangles, the output would be the set of coordinates
of the 12 red lines.


You're trying to compute the boundary polygon of the union of
rectangles. It's standard computational geometry. The CGAL library
will handle it easily. I'm a bit surprised that it's not easy to
find code on line, but here are some places to look.

This particular problem was studied long ago in conjunction with VLSI
design. See for example: http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?tp=&arnumber=1585410&isnumber=33444

Line sweep algorithms are often used to solve problems like this
efficiently. So try searching for "line sweep rectangle union". or
"line sweep rectangle boolean operation".

There's code at

http://olympiad.cs.uct.ac.za/presentations/camp1_2009/linesweep_handout.pdf

for a tiny program to compute the area of a rectangle union. It will
not be too hard to modify this to get the boundary.

There's also an interesting-looking paper at

http://dml.cz/bitstream/handle/10338.dmlcz/104022/AplMat_28-1983-3_2.pdf

You might also search for "line sweep polygon union" or "line sweep
polygon boolean operation", which will give you the more general
algorithms that you can simplify for the case of rectangles.
.



Relevant Pages

  • Re: Finding lines surrounding set of rectangles
    ... of the three blue rectangles, the output would be the set of coordinates ... Line sweep algorithms are often used to solve problems like this ... So try searching for "line sweep rectangle union". ...
    (comp.programming)
  • Re: covering with rectangles
    ... > Do the rectangles have to be disjoint from each other? ... there's an algorithm based on bipartite matching (in a graph the ... > concave endpoints, with an edge between two vertices if the ... > corresponding diagonals cross or share an endpoint). ...
    (sci.math)
  • RE: rectangle layout algorithm?
    ... Diez Roggisch replies: ... completely irrelevent if the number of rectangles to be laid out is ... algorithm to...". ... def layout(bounds, images): ...
    (comp.lang.python)
  • Re: covering with rectangles
    ... Do the rectangles have to be disjoint from each other? ... there's an algorithm based on bipartite matching (in a graph the ... vertices of which are horizontal and vertical diagonals that have two ... concave endpoints, with an edge between two vertices if the ...
    (sci.math)
  • Re: Finding rectangles within rectangular boundary
    ... I have a set of N rectangles. ... But I guess there must be an algorithm that scales better ... boundaries to test is greater than logor not. ... cases instead of having to list the Osuccess cases, ...
    (comp.programming)