Re: Determining if a point on a 2D polygon is hidden
- From: "Dave Eberly" <dNOSPAMeberly@xxxxxxxxxxxxxxx>
- Date: Tue, 18 Oct 2005 18:08:24 GMT
"Stefan Rybacki" <stefan.rybacki@xxxxxxx> wrote in message
news:3rkr05Fk58ndU2@xxxxxxxxxxxxxxxxx
> The easiest way to determine whether an external point can see
> another one, is to shot a ray from the external point to the other
> one and see whether there is an intersection between the polygon
> and the ray before the ray reaches your point.
This is an O(n^3) algorithm, which is reasonable for a small number
of polygon vertices, and is simple to implement. It is possible to
cull some of the ray-edge tests and reduce some of the computation
time. If P is the external point and V1 is the vertex of the current
query, let <V0,V1,V2> be consecutive vertices of the simple
polygon. You need not test every edge of the polygon against
the segment <P,V1>, only those in the cone defined by <V0,V1,V2>.
This culling is particularly useful in reducing the costs in dynamic path
finding. In fact if the query will be repeated for a large number of
points P, you could preprocess the polygon and store at each vertex
a list of edges that must be tested.
The topic of "visibility graphs" is covered in Joseph O'Rourke's book
"Computational Geometry in C, Second Edition". Section 8.2.2
mentions the O(n^3) algorithm, but points out that use of
"arrangements" leads to an optimal O(n^2) algorithm. Also
mentioned is the paper
S.K. Ghosh and D.M. Mount,
An output-sensitive algorithm for computing visibility graphs,
SIAM J. Comput. vol. 20, pp. 888-910, 1991.
where the algorithm is O(n log n + E), where E is the number of
graph edges. This number is O(n^2), but in practice is usually
small.
--
Dave Eberly
http://www.geometrictools.com
.
- Follow-Ups:
- Re: Determining if a point on a 2D polygon is hidden
- From: Stefan Rybacki
- Re: Determining if a point on a 2D polygon is hidden
- References:
- Determining if a point on a 2D polygon is hidden
- From: Michele Locati
- Re: Determining if a point on a 2D polygon is hidden
- From: Michele Locati
- Re: Determining if a point on a 2D polygon is hidden
- From: Stefan Rybacki
- Determining if a point on a 2D polygon is hidden
- Prev by Date: Interpolating function with two important characteristics
- Next by Date: Re: Interpolating function with two important characteristics
- Previous by thread: Re: Determining if a point on a 2D polygon is hidden
- Next by thread: Re: Determining if a point on a 2D polygon is hidden
- Index(es):
Relevant Pages
|
Loading