INSIDE Name
INSIDE Purpose
The purpose of this function is to indicate whether a specified
2D point is inside (returns a 1) a specified 2D polygon or outside
(returns a 0). Author
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Category
Utility.
Calling Sequence
result = INSIDE(x, y, xpts, ypts) Inputs
x: A scalar or vector of the x coordinates of the 2D point(s) to check.
y: A scalar or vector of the y coordinates of the 2D point(s) to check.
xpts: The x coordinates of the 2D polygon.
ypts: The y coordinates of the 2D polygon.
Outputs
result: A scalar or vector set to 1 if the point is inside the polygon and to
0 if the point is outside the polygon.
Keywords
INDEX: An output keyword. If set to a named variable, will return the indices
of the X and Y points that are inside the polygon.
ALGORITHM:
Based on discussions on the IDL newsgroup (comp.lang.idl-pvwave) and
discussed here:
http://www.idlcoyote.com/tips/point_in_polygon.html
Primarily the work of B�rd Krane and William Connelly.
Modification History
Written by: David W. Fanning, 4 September 2003.
Vectorized the function in accord with William Connelly's suggestions 24 July 2005. DWF.