Learn R Programming

ScatterDensity (version 0.1.1)

PointsInPolygon: PointsInPolygon

Description

Defines a Cls based on points in a given polygon.

Usage

PointsInPolygon(Points, Polygon, PlotIt = FALSE, ...)

Value

Numerical classification vector Cls with 1 = outside polygon and 2 = inside polygon

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

...

BMUorProjected: Default == FALSE, If TRUE assuming BestMatches of ESOM instead of Projected Points

main: title of plot

Further Plotting Arguments,xlab etc used in Classplot

Author

Michael Thrun

Details

We assume that polygon is closed, i.e., that the last point connects to the fist point

See Also

Classplot

Examples

Run this code
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
# \donttest{
Cls=PointsInPolygon(XY,polymat,PlotIt = TRUE)
# }

Run the code above in your browser using DataLab