cartesian_to_spherical
- miepython.util.cartesian_to_spherical(x, y, z)[source]
Convert Cartesian coordinates (x, y, z) to spherical (r, theta, phi).
Scalars and arrays are both accepted and the three inputs are broadcast against each other. At the origin theta is reported as 0, and z/r is clipped so that rounding cannot push the arccos argument outside [-1, 1].
- Parameters:
x – Cartesian x coordinate, scalar or array-like
y – Cartesian y coordinate, scalar or array-like
z – Cartesian z coordinate, scalar or array-like
- Returns:
r, theta, phi – radius, polar angle from +z, azimuth from +x toward +y