Visible objects from a point in a polygon with holes in 2d

397 Views Asked by At

The problem is the following:

Given a polygon P with h holes/objects and a point c inside P but outside the holes/objects. P has n given vertices and each hole/object h has 4 vertices (the holes/objects are rectangles).

Is there an efficient algorithm that can compute wich holes/objects are seen by c inside P ?

I have seen visibility poligon algorithms but I'm not interested in having a visual representation, but rather in time optimization and getting the list of observed holes/objects.

Thanks!

1

There are 1 best solutions below

0
On

I don't understand why you dismiss the visibility polygon. I think it's the right tool for this job, and not just for "having a visual representation":

Given a visibility polygon $V$, you can check whether an object $O$ can be seen from point $c$ by testing if (some part of) $O$ is inside $V$. This is true if any vertex of $O$ is inside $V$ or if any edge of $O$ intersects any edge of $V$. For complex polygons and/or many objects, these checks may be sped up by clever use of space partitioning.