sl.point.between: Check if Point Between Points

View source: R/sl.point.between.R

sl.point.betweenR Documentation

Check if Point Between Points

Description

Check if a point is located on the (shortest) line between two points on a sphere, UNDER THE ASSUMPTION THAT the point is located either on the shorter or the longer part of the great-circle line defined by the two points.

Usage

sl.point.between(p.lon, p.lat, line.lon, line.lat)

Arguments

p.lon

a scalar specifying the longitude of the point.

p.lat

a scalar specifying the latitude of the point.

line.lon

a vector of length 2 specifying the longitudes of the line end points.

line.lat

a vector of length 2 specifying the latitudes of the line end points.

Details

Given that the function works under the assumption that the point is located either on the shorter or the longer part of the great-circle line defined by the two points, the result is not meaningful if that assumption is not met. If in doubt, use sl.checkposition to check the assumption.

Value

a logical value indicating whether or not the point is located on the shortest line between the two points.

Author(s)

Helge Goessling

See Also

sl.checkposition

Examples

sl.point.between(90,0,c(0,170),c(0,0))
## Should return:
## [1] TRUE

sl.point.between(90,0,c(0,190),c(0,0))
## Should return:
## [1] FALSE

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