| 1 |
\name{point.in.polygon} |
| 2 |
\alias{point.in.polygon} |
| 3 |
\title{ do point(s) fall in a given polygon? } |
| 4 |
\description{ |
| 5 |
verifies for one or more points whether they fall in a given polygon |
| 6 |
} |
| 7 |
\usage{ |
| 8 |
point.in.polygon(point.x, point.y, pol.x, pol.y, mode.checked=FALSE) |
| 9 |
} |
| 10 |
\arguments{ |
| 11 |
\item{point.x}{numerical array of x-coordinates of points} |
| 12 |
\item{point.y}{numerical array of y-coordinates of points} |
| 13 |
\item{pol.x}{numerical array of x-coordinates of polygon} |
| 14 |
\item{pol.y}{numerical array of y-coordinates of polygon} |
| 15 |
\item{mode.checked}{default FALSE, used internally to save time when all the other argument are known to be of storage mode double} |
| 16 |
} |
| 17 |
\value{ integer array; values are: |
| 18 |
0: point is strictly exterior to pol; |
| 19 |
1: point is strictly interior to pol; |
| 20 |
2: point lies on the relative interior of an edge of pol; |
| 21 |
3: point is a vertex of pol. |
| 22 |
} |
| 23 |
\references{ |
| 24 |
Uses the C function InPoly(). InPoly is Copyright (c) 1998 by |
| 25 |
Joseph O'Rourke. It may be freely redistributed in its entirety |
| 26 |
provided that this copyright notice is not removed. |
| 27 |
} |
| 28 |
\examples{ |
| 29 |
# open polygon: |
| 30 |
point.in.polygon(1:10,1:10,c(3,5,5,3),c(3,3,5,5)) |
| 31 |
# closed polygon: |
| 32 |
point.in.polygon(1:10,rep(4,10),c(3,5,5,3,3),c(3,3,5,5,3)) |
| 33 |
} |
| 34 |
\keyword{manip} |