Processing math: 100%

spherical2cartesian provides spherical to Cartesian coordinate conversion.

spherical2cartesian(r, theta = NULL, phi = NULL)

Arguments

r

a vector of radii (or a vector of length 3 holding r,theta,phi)

theta

a vector of inclinations

phi

a vector of azimuths

Value

A list of x, y, and z Cartesian coordinates.

See also

Examples

spherical2cartesian(1, 0, pi / 2)
#> x y z #> 0 0 1
spherical2cartesian(1, pi, pi / 4)
#> x y z #> 8.659561e-17 8.659561e-17 -1.000000e+00
spherical2cartesian(c(1, pi, pi / 4))
#> x y z #> 8.659561e-17 8.659561e-17 -1.000000e+00