Learn R Programming

recexcavAAR (version 0.2.2)

pnpmulti: Check if multiple points are within a polygon (2D)

Description

pnpmulti works as pnp but for multiple points.

Usage

pnpmulti(vertx, verty, testx, testy)

Arguments

vertx
vector of x axis values of polygon corner points
verty
vector of y axis values of polygon corner points
testx
vector of x axis values of points of interest
testy
vector of y axis values of points of interest

Value

vector with boolean values - TRUE, if the respective point is within the polygon. Otherwise FALSE.

See Also

Other pnpfuncs: pnp

Examples

Run this code
polydf <- data.frame(
  x = c(1,1,2,2),
  y = c(1,2,1,2)
)

testdf <- data.frame(
  x = c(1.5, 2.5),
  y = c(1.5, 2.5)
)

pnpmulti(polydf$x, polydf$y, testdf$x, testdf$y)

Run the code above in your browser using DataLab