Learn R Programming

spatialkernel (version 0.4-23)

pinpoly: Check if Points are within Polygon

Description

Check the location of point(s) with respect to a polygon.

Usage

pinpoly(poly, pts)

Arguments

poly

matrix containing the x,y-coordinates of the vertices of the polygon boundary.

pts

matrix of containing the x,y-coordinates of the point locations.

Value

An integer vector of indicators for each point in pts,

-1

error when number of polygon vertices exceeds 3000;

0

outside the polygon;

1

at the polygon boundary;

2

inside the polygon.

References

This Fortran code comes from Wm Randolph Franklin, Electrical, Computer, and Systems Engineering Department, Rensselaer Polytechnic Institute, Troy, New York, at website http://www.ecse.rpi.edu/Homepages/wrf.

See Also

phat and mcseg.test