pointsInPoly: Points inside/outside polygon determination

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pointsInPoly.r

Description

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

Usage

1
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

1
2
3
4
5
6
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)

HRW documentation built on Nov. 23, 2021, 9:07 a.m.

Related to pointsInPoly in HRW...