View source: R/sl.fillequidist.R
sl.fillequidist | R Documentation |
Insert points at equidistant locations along a line on a sphere. By default (for backwards compatibility) the algorithm works in x-y-z coordinates. This means that, if more than one point is added, the points are not exactly equidistant in terms of great-circle distances after projection onto the sphere, with deviations becoming large for long lines. To obtain accurate equidistant spacing on the sphere, set method="gc"
.
See sl.p2p
for an alternative where arbitrary fractions can be specified.
sl.fillequidist(lon, lat, np = 1, method = "xyz", return.xyz = FALSE)
lon |
a vector of length 2 with the longitudes of the start and end points of the line. |
lat |
a vector of length 2 with the latitudes of the start and end points of the line. |
np |
an integer giving the number of points to be inserted. Default is 1 (in which case the algorithm is exact even for long lines). |
method |
a character specifying whether points are placed equidistant in x-y-z space and then reprojected onto the sphere ( |
return.xyz |
a logical value specifying whether to return also x-y-z coordinates of the resulting points. Default is |
A list with the following elements, with the last three being optional, depending on return.xyz
:
lon |
a vector of length |
lat |
a vector of length |
x |
a vector of length |
y |
a vector of length |
z |
a vector of length |
Helge Goessling
sl.p2p
sl.fillequidist(c(0,10),c(0,0),np=2)
## Should return:
## $lon
## [1] 3.329563 6.670437
##
## $lat
## [1] 0 0
sl.fillequidist(c(0,10),c(0,0),np=2,method="gc")
## Should return:
## $lon
## [1] 3.333333 6.666667
##
## $lat
## [1] 2.345519e-15 1.174747e-15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.