sl.line.lat.intersect: Check if/where Line Intersects with Latitude

View source: R/sl.line.lat.intersect.R

sl.line.lat.intersectR Documentation

Check if/where Line Intersects with Latitude

Description

Check if and where a (great-circle) line defined by two points on a sphere intersects with a given latitude. Check also if the intersection point(s) lie(s) on the shorther way between the points.

Usage

sl.line.lat.intersect(line.lon, line.lat, lat0)

Arguments

line.lon

a vector of length 2 with the longitudes of the two points defining the great-circle line.

line.lat

a vector of length 2 with the latitudes of the two points defining the great-circle line.

lat0

a scalar giving the latitude for which intersection points are sought.

Value

line.lat.intersect

a logical value indicating whether the line intersects with the latitude between the two points (on the shorter way).

lat

equals the argument lat0.

lon

if existent, the longitude at which the great circle line (shorter and longer way) intersects with the latitude.

line.lat.intersect.twice

a logical value indicating whether the line intersects twice with the latitude between the two points (on the shorter way).

lon2

if existent, the second longitude at which the line intersects with the latitude (on the shorter way).

gcline.lat.intersect

an integer indicating how often the complete great-circle line (shorter and longer way) intersects with the latitude (must be 0, 1, or 2).

x

if existent, a scalar giving the x coordinate of the first intersection point (on a unit sphere).

y

if existent, a scalar giving the y coordinate of the first intersection point (on a unit sphere).

z

if existent, a scalar giving the z coordinate of the first intersection point (on a unit sphere).

x2

if existent, a scalar giving the x coordinate of the second intersection point (on a unit sphere).

y2

if existent, a scalar giving the y coordinate of the second intersection point (on a unit sphere).

z2

if existent, a scalar giving the z coordinate of the second intersection point (on a unit sphere).

Author(s)

Helge Goessling

Examples

sl.line.lat.intersect(line.lon=c(0,1),line.lat=c(0,1),lat0=30)
## Should return:
## $line.lat.intersect
## [1] FALSE
## 
## $lat
## [1] 30
## 
## $lon
## [1] 35.25822
## 
## $line.lat.intersect.twice
## [1] FALSE
## 
## $lon2
## [1] 144.7418
## 
## $gcline.lat.intersect
## [1] 2
## 
## $x
## [1] 0.7071606
## 
## $y
## [1] 0.4999238
## 
## $z
## [1] 0.5
## 
## $x2
## [1] -0.7071606
## 
## $y2
## [1] 0.4999238
## 
## $z2
## [1] 0.5

FESOM/spheRlab documentation built on April 6, 2024, 6:52 p.m.