PointsInPolygon {ScatterDensity} | R Documentation |
PointsInPolygon
Description
Defines a Cls based on points in a given polygon.
Usage
PointsInPolygon(Points, Polygon, PlotIt = FALSE, ...)
Arguments
Points |
[1:n,1:2] xy cartesian coordinates of a projection |
Polygon |
Numerical matrix of 2 columns defining a closed polygon |
PlotIt |
TRUE: Plots marked points |
... |
Further Plotting Arguments,xlab etc used in |
Details
We assume that polygon is closed, i.e., that the last point connects to the fist point
Value
Numerical classification vector Cls with 1 = outside polygon and 2 = inside polygon
Author(s)
Michael Thrun
See Also
Examples
XY=cbind(runif(80,min = -1,max = 1),rnorm(80))
#closed polygon
polymat <- cbind(x = c(0,1,1,0), y = c(0,0,1,1))
#takes sometimes more than 5 sec
Cls=PointsInPolygon(XY,polymat,PlotIt = TRUE)
[Package ScatterDensity version 0.0.4 Index]