e15190.utilities.geometry.spherical_to_cartesian

e15190.utilities.geometry.spherical_to_cartesian(*args)

Convert spherical coordinates to Cartesian coordinates.

Parameters

args (3-tuple of scalars, 3-tuple of 1D numpy arrays or a 2D numpy array) –

If the input is a 3-tuple of scalars or a 3-tuple of 1D numpy arrays, they will be interpreted as \((r, \theta, \phi)\).

If the input is a 2D numpy array of shape (n_vectors, 3), it will be interpreted as an array of row vectors \((r, \theta, \phi)\).

\(r\) is the distance from the origin. Accepts any real numbers. Negative radius is simply interpreted as the opposite direction, e.g. \((1, 2, 3)\) becomes \((-1, -2, -3)\).

\(\theta\) is the polar angle of the point in radians. Accepts any real numbers, but expect identical result for any theta with the same \(\mathrm{mod}(\theta, 2\pi)\) value.

\(\phi\) is the azimuthal angle of the point in radians. Accepts any real numbers, but expect identical result for any phi with the same \(\mathrm{mod}(\phi, 2\pi)\) value.

Returns

cartesian_coordinates – Cartesian coordinates of the inputs.

Return type

same as args