sl.inpolygon.convex: Check if Point Inside Convex Polygon

sl.inpolygon.convexR Documentation

Check if Point Inside Convex Polygon

Description

Check whether a point is located inside a convex polygon on a sphere.

Usage

sl.inpolygon.convex(lon.point, lat.point, lon, lat, check.ccw.convex = TRUE, border.as.in = TRUE)

Arguments

lon.point

a scalar giving the longitude of the point.

lat.point

a scalar giving the latitude of the point.

lon

a vector giving the longitudes of the polygon.

lat

a vector giving the latitudes of the polygon.

check.ccw.convex

a logical value indicating whether it is checked at the beginning if the polygon fulfills the requirements for the algorithm to work, that is, if the polygon is ordered counterclockwise and if it is convex. The default is check.ccw.convex=TRUE. If the requirements are known to be true, setting check.ccw.convex=FALSE increases the computational efficiency.

border.as.in

a logical value indicating whether the polygon edges are counted as 'inside'.

Value

A logical value indicating whether the point is located inside the polygon.

Author(s)

Helge Goessling

Examples

sl.inpolygon.convex(lon.point=0,lat.point=0,lon=c(-10,-10,10,10),lat=c(10,-10,-10,10))
## Should return:
## [1] TRUE

sl.inpolygon.convex(lon.point=0,lat.point=20,lon=c(-10,-10,10,10),lat=c(10,-10,-10,10))
## Should return:
## [1] FALSE

helgegoessling/spheRlab documentation built on April 8, 2024, 8:34 a.m.