colour.algebra.cartesian_to_polar#

colour.algebra.cartesian_to_polar(a: ArrayLike) NDArrayFloat[source]#

Transform given cartesian coordinates array \(xy\) to polar coordinates array \(\rho\phi\) (radial coordinate, angular coordinate).

Parameters:

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

Returns:

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

Return type:

numpy.ndarray

References

[Wikipedia06a], [Wikipedia05e]

Examples

>>> a = np.array([3, 1])
>>> cartesian_to_polar(a)  
array([ 3.1622776...,  0.3217505...])