colour.algebra.cartesian_to_spherical

colour.algebra.cartesian_to_spherical(a: ArrayLike) numpy.ndarray[source]

Transform given cartesian coordinates array \(xyz\) to spherical coordinates array \(\rho\theta\phi\) (radial distance, inclination or elevation and azimuth).

Parameters

a (ArrayLike) – Cartesian coordinates array \(xyz\) to transform.

Returns

Spherical coordinates array \(\rho\theta\phi\), \(\rho\) is in range [0, +inf], \(\theta\) is in range [0, pi] radians, i.e. [0, 180] degrees, and \(\phi\) is in range [-pi, pi] radians, i.e. [-180, 180] degrees.

Return type

numpy.ndarray

References

[Wikipedia06a], [Wikipedia05b]

Examples

>>> a = np.array([3, 1, 6])
>>> cartesian_to_spherical(a)  
array([ 6.7823299...,  0.4850497...,  0.3217505...])