Conversion of polar coordinates to 3d Cartesian coordinates
The function uses basic trigonometric relationships to transform longitude/latitude coordinates on a sphere to xyz Cartesian coordinates.
PolToCar(x, ...) ## S4 method for signature 'matrix' PolToCar(x, radius = authRadius, origin = c(0, 0, 0)) ## S4 method for signature 'numeric' PolToCar(x, radius = authRadius, origin = c(0, 0, 0)) ## S4 method for signature 'data.frame' PolToCar(x, radius = authRadius, origin = c(0, 0, 0), long = NULL, lat = NULL)
x |
( |
... |
Arguments passed to class-specific methods. |
radius |
( |
origin |
( |
long |
( |
lat |
( |
The authalic mean radius of Earth (6371.007 km) is used by this function as a default. The origin is c(0,0,0)
. The precision of these conversions is not exact (see example c(0,90)
below),
but should be considered acceptable when applied at a reasonable scale (e.g. for global analyses using data above 10e-6
meters of resolution).
An xyz 3-column numeric matrix
, data.frame
or numeric
, depending on the class of x
.
longLat <- rbind( c(0,0), #note the precision here! c(0, 90), c(-45,12) ) # matrix-method xyz <- PolToCar(longLat) # numeric-method xyz2 <- PolToCar(longLat[1,]) # data.frame method xyz3 <- PolToCar(as.data.frame(longLat))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.