colour.algebra.cartesian_to_polar

colour.algebra.cartesian_to_polar(a)[source]

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

Parameters

a (array_like) – 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

ndarray

References

[Wik06a], [Wik05b]

Examples

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