point.in.polygon {gstat} | R Documentation |
verifies for one or more points whether they fall in a given polygon
point.in.polygon(point.x, point.y, pol.x, pol.y)
point.x |
numerical array of x-coordinates of points |
point.y |
numerical array of y-coordinates of points |
pol.x |
numerical array of x-coordinates of polygon |
pol.y |
numerical array of y-coordinates of polygon |
logical array; FALSE if a point is strictly exterior to the polygon, TRUE if not (point is strictly interior to polygon, point is a vertex of polygon, or point lies on the relative interior of an edge of polygon)
Uses the C function InPoly(), in gstat file polygon.c; InPoly is Copyright 1998 by Joseph O'Rourke. It may be freely redistributed in its entirety provided that this copyright notice is not removed.
# open polygon: point.in.polygon(1:10,1:10,c(3,4,4,3),c(3,3,4,4)) # closed polygon: point.in.polygon(1:10,1:10,c(3,4,4,3,3),c(3,3,4,4,3))