Skip to contents

Non-finite inputs return NA.

Usage

spherical_to_z(rho, theta)

Arguments

rho

A numeric vector of cylindrical radii, that is sqrt(x^2 + y^2).

theta

A numeric vector of inclination angles measured from the positive z-axis, in radians.

Value

A numeric vector of z-coordinates, the same length as rho.

Examples

spherical_to_z(1, pi / 4)
#> [1] 0.7071068

# Non-finite input propagates as NA
spherical_to_z(c(1, NA), c(pi / 4, pi / 4))
#> [1] 0.7071068        NA