spherical2cartesian

sf3dmodels.tools.transform.spherical2cartesian(r=None, theta=None, phi=None)[source] [edit on github]

Converts spherical coordinates to rectangular cartesian coordinates.

Parameters:
r : scalar or array_like, shape (n,)

Radial distance from the origin of coordinates to the point in question.

theta : scalar or array_like, shape (n,)

Polar angle referred to the positive z - axis.

phi : scalar or array_like, shape (n,)

Azimuthal angle referred to the positive x - axis.

Returns:
out : numpy.ndarray, shape (3,n)

Array-like object with the resulting x,y,z transformation.

Notes

Transformation equations:

\[ \begin{align}\begin{aligned}x &= r\sin(\theta)\cos(\phi) \\y &= r\sin(\theta)\sin(\phi) \\z &= r\cos(\theta)\end{aligned}\end{align} \]