HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Compute visible vertices of a polygon

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
polygonvisibleverticescompute

Problem

Given a simple polygon $P$ and a point $p$ within the polygon, I want to compute the vertices of $P$ visible from point $p$. A point $q$ is visible from point $p$, if the line segment $\overline{qp}$ is completely in the polygon $P$.

One can use the accepted answer here to compute visible vertices in $P$ from a point $p$ in $\mathcal{O}(n\log{}n)$.

My question is, does an algorithm exist to do it in $\mathcal{O}(n)$ time?

Solution

Yes, there are more algorithms to do so in $\mathcal O(n)$. The first is dated back to ElGindy and Avis in 1981, Lee 1983 and Joe & Simpson in 1985. The visibility algorithms use stack (the first one three stacks, further only one) and process vertices in order they appear at boundary.

The visibility algorithms described in book Art Gallery Theorems and Algorithms by Joseph O'Rourke. The book is out of print, available online.

Also author wrote a paper the vertex-edge visibility graph of polygon with Ileana Streinu in 1996, which with Chazelle's linear time triangulation and slight modification (simply by adding two edges from given point) would solve the problem in linear time.

Context

StackExchange Computer Science Q#84364, answer score: 3

Revisions (0)

No revisions yet.