Skip to contents

Converts between Cartesian and spherical coordinates

Usage

to_vec(x)

to_spherical(x, class = c("line", "plane"))

line2vec(l)

plane2vec(p)

vec2line(x)

vec2plane(x)

Arguments

x

3three-column array, or three-element vector. Cartesian coordinates

class

character. Either "line" or "plane"

l, p

two column array, or two element vector. Spherical coordinates (in degrees) of lines ("azimuth", "plunge") or plane ("dip_direction", "dip").

Examples

cbind(c(90, 89), c(45, 46)) |>
  line2vec() |>
  vec2line()
#>      azimuth plunge
#> [1,]      90     45
#> [2,]      89     46
#> attr(,"class")
#> [1] "line"