Re: Covering rectangles in 2D



On Mon, 17 Mar 2008 02:58:00 -0000, Tim Little
<tim@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

On 2008-03-16, Hector <encapuchado@xxxxxxxxx> wrote:
Suppose there is a big rectangle, 'A', and suppose that I put
several smaller rectangles over 'A'. The small rectangles can be
overlapped, but they are all inside 'A'. The question is, is it
possible to know whether 'A' is totally covered?

Sure: if nothing else, divide A up into a grid using the edges of the
rectangles as grid lines.

In general this would be O(N^2) in the number of rectangles, which is
a bit of a nuisance. I'm sure there are faster methods.

That's a nice method.

But I highly doubt that you can do better than O(N^2).

In fact, I don't even see how the method you suggest _is_ O(N^2).
Perhaps I misunderstand your intended method, but as I see it, it's
O(N^3).

On the other hand, the algorithm I proposed _is_ O(N^2), or at least
I'm fairly sure that it is, and moreover, I believe that my algorithm
is best possible as far as order of magnitude.

quasi
.



Relevant Pages

  • Re: Covering rectangles in 2D
    ... In general this would be Oin the number of rectangles, ... top-left grid square is in. ... I strongly suspect that an algorithm with a better bound than O ...
    (sci.math)
  • Re: Covering rectangles in 2D
    ... In general this would be Oin the number of rectangles, ... top-left grid square is in. ... I strongly suspect that an algorithm with a better bound than O ...
    (sci.math)
  • Re: Finding lines surrounding set of rectangles
    ... 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 ... 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)

Quantcast