comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: point inside polygon
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: point inside polygon [message #11494 is a reply to message #11384] Wed, 01 April 1998 00:00 Go to previous messageGo to previous message
manizade is currently offline  manizade
Messages: 9
Registered: October 1993
Junior Member
>> In article C0684CDB@oma.be, Philippe Peeters <philp@oma.be> writes:
>>> Does anybody knows of an IDL function to test whether a given point is
>>> inside a polygon?
The proposed polyfill approaches are limited by the resolution
of the bitmap used.

In general, you can decompose any polygon into a set of
triangles (using TRIANGULATE), then determine whether
the point is included in any of the triangular regions.
TRIANGULATE gives each vertex list in counterclockwise order,
so a point is inside the triangle if it is to the left of each
directed edge of the triangle.

Suppose you have a directed line from point L1 to point L2,
where the the x coordinate of L1 is L1[0] and the y coordinate
is L1[1]; L2[0], L2[1] are the (x,y) coords of L2; and px,py are
the coordinates of the point in question.
Then the boolean answer to whether the point is to the left of
the line is given by
(L1(1)-L2(1))*(L1(0)-px) LE (L1(0)-L2(0))*(L1(1)-py)

I have not seen an approach to this problem other that what I
invented (and I'm sure I am not the only one to (re)invent it).
Any other solutions out there?
--
Serdar S. Manizade <serdar.manizade@gsfc.nasa.gov>
Airborne Topographic Mapper Project
NASA/GSFC/Wallops Flight Facility, Wallops Island, VA
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Volume Size
Next Topic: Re: Three questions

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:02:41 PDT 2025

Total time taken to generate the page: 0.48046 seconds