Re: [S] Points in or out of polygon

Alan Zaslavsky (
Wed, 4 Mar 1998 15:03:02 -0500 (EST)

> I have a need to determine whether or not points are in or out of
> arbitrarily shaped and located polygons. Has anyone written an S-PLUS
> function that would do something like, given the x-y coordinates of
> the vertices of a polygon, determine whether the x-y coordinates of
> another point are inside or outside of it?

If you just need to know whether they are ALL inside, you can pass
the full set of points (test points, and points on the polygon) to
chull(), which will tell you whether any of the test points are on
the convex hull and therefore outside the polygon.
This message was distributed by To unsubscribe
send e-mail to with the BODY of the
message: unsubscribe s-news