View source: R/sl.line.line.intersect.R
sl.line.line.intersect | R Documentation |
Check where two lines on a sphere, defined by two times two points, intersect, and whether they intersect on the shorter ways of the great-circle line.
sl.line.line.intersect(line1.lon, line1.lat, line2.lon, line2.lat)
line1.lon |
a vector of length 2 giving the longitudes of the points of the first line. |
line1.lat |
a vector of length 2 giving the latitudes of the points of the first line. |
line2.lon |
a vector of length 2 giving the longitudes of the points of the second line. |
line2.lat |
a vector of length 2 giving the latitudes of the points of the second line. |
If the lines intersect on the shorter ways of the great-circle line (that is, if lines.intersect=TRUE
), that point will be in the first set of output variables (that is, the variables without '2' in the name). THIS FUNCTION NEEDS MODIFICATION: IT CURRENTLY FAILS WHEN THE LINES ARE IDENTICAL.
lines.intersect |
a logical value indicating whether the lines intersect on the shorter ways of the great-circle lines. |
lon |
a scalar giving the longitude of the first intersection point. |
lat |
a scalar giving the latitude of the first intersection point. |
lon2 |
a scalar giving the longitude of the second intersection point. |
lat2 |
a scalar giving the latitude of the second intersection point. |
x |
a scalar giving the |
y |
a scalar giving the |
z |
a scalar giving the |
x2 |
a scalar giving the |
y2 |
a scalar giving the |
y3 |
a scalar giving the |
Helge Goessling
sl.line.line.intersect(line1.lon=c(0,10),line1.lat=c(0,0),line2.lon=c(0,10),line2.lat=c(10,5))
## Should return:
## $lines.intersect
## [1] FALSE
##
## $lon
## [1] -160.4361
##
## $lat
## [1] 0
##
## $lon2
## [1] 19.56389
##
## $lat2
## [1] 0
##
## $x
## [1] -0.01467808
##
## $y
## [1] -0.005216208
##
## $z
## [1] 0
##
## $x2
## [1] 0.01467808
##
## $y2
## [1] 0.005216208
##
## $z2
## [1] 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.