pointsInPoly {HRW}R Documentation

Points inside/outside polygon determination

Description

Determination of whether each member of a set of bivariate points are inside a polygon.

Usage

pointsInPoly(pointsCoords,polygon)

Arguments

pointsCoords

two-column matrix with each row specifying the (x,y) coordinates of a point.

polygon

two-column matrix with each row specifying the (x,y) coordinates of a vertex of a polygon.

Details

Geometric results are used to determine whether each of a set of bivariate points is inside or outside a polygon. A Boolean vector of indicators of whether or not each point is inside the polygon is returned.

Value

A Boolean array with length equal to the number of rows in ‘pointsCoords’ corresponding to whether or not each of the corresponding points in 'pointCoords' are inside 'polygon'.

Author(s)

M.P. Wand matt.wand@uts.edu.au

See Also

createBoundary

Examples

library(HRW)
myPolygon <- rbind(c(1,9),c(8,8),c(9,3),c(3,2),c(1,9))/10
plot(0:1,0:1,type = "n") ; lines(myPolygon)
xyMat <- cbind(runif(10),runif(10))
inPoly <- pointsInPoly(xyMat,myPolygon) ; print(inPoly)
points(xyMat[,1],xyMat[,2],col = as.numeric(inPoly) + 2)

[Package HRW version 1.0-5 Index]