in.W: Determining If a Point is in a Region

View source: R/in.W.R

in.WR Documentation

Determining If a Point is in a Region

Description

This function determines whether a given point or points is/are inside the given window, which is a (subset) of the sphere.

Usage

in.W(points, win)

Arguments

points

A 2 column matrix giving the locations of all points to be tested.

win

The window. An object of type sphwin.

Details

This function establishes whether each point in points is in the window specified in win. A point is considered to be in the window if it is within or on the boundaries of the window, including the vertices.

The algorithm used in the case that win is a spherical polygon is that developed by Bevis and Chatelain (1989).

Value

A logical of same length as the number of points being tested. The first element is TRUE if the point whose coordinates are in the first row of points is in the window specified in win, and FALSE otherwise.

Warning

On any sphere, the boundaries that define a window W on the sphere also define a second shape W2, that containing all the boundaries and vertices of W, and the complement of W. Since the two shapes have boundaries and vertices in common, the set of all points that this function would identify as being outside W is not the set of all points in W2.

Author(s)

Tom Lawrence <email:tjlawrence@bigpond.com>

References

Bevis, M. and Chatelain J.-L. (1989) Locating a point on a spherical surface relative to a spherical polygon of arbitrary shape. Mathematical Geology 21, no. 8, pp. 811–827.

Examples

sphcap <- sphwin(type="band", param=c(0, pi/3), ref=c(0,0))
sphband <- sphwin(type="band", param=c(pi/6, pi/2), ref=c(0,0))
rpp.band <- rpoispp.sphwin(win=sphband, lambda=10)
in.W(points=rpp.band, win=sphcap)

baddstats/spherstat documentation built on Feb. 6, 2023, 1:45 a.m.