# colour.algebra.coordinates Package¶

## Module Contents¶

colour.algebra.coordinates.cartesian_to_spherical(a)[source]

Transforms given Cartesian coordinates array $$xyz$$ to Spherical coordinates array $$\rho\theta\phi$$ (radial distance, inclination or elevation and azimuth).

Parameters: a (array_like) – Cartesian coordinates array $$xyz$$ to transform. Spherical coordinates array $$\rho\theta\phi$$. ndarray

Examples

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

colour.algebra.coordinates.spherical_to_cartesian(a)[source]

Transforms given Spherical coordinates array $$\rho\theta\phi$$ (radial distance, inclination or elevation and azimuth) to Cartesian coordinates array $$xyz$$.

Parameters: a (array_like) – Spherical coordinates array $$\rho\theta\phi$$ to transform. Cartesian coordinates array $$xyz$$. ndarray

Examples

>>> a = np.array([6.78232998, 1.08574654, 0.32175055])
>>> spherical_to_cartesian(a)
array([ 3.        ,  0.9999999...,  6.        ])

colour.algebra.coordinates.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. Polar coordinates array $$\rho\phi$$. ndarray

Examples

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

colour.algebra.coordinates.polar_to_cartesian(a)[source]

Transforms given Polar coordinates array $$\rho\phi$$ (radial coordinate, angular coordinate) to Cartesian coordinates array $$xy$$.

Parameters: a (array_like) – Polar coordinates array $$\rho\phi$$ to transform. Cartesian coordinates array $$xy$$. ndarray

Examples

>>> a = np.array([3.16227766, 0.32175055])
>>> polar_to_cartesian(a)
array([ 3.        ,  0.9999999...])

colour.algebra.coordinates.cartesian_to_cylindrical(a)[source]

Transforms given Cartesian coordinates array $$xyz$$ to Cylindrical coordinates array $$\rho\phi z$$ (azimuth, radial distance and height).

Parameters: a (array_like) – Cartesian coordinates array $$xyz$$ to transform. Cylindrical coordinates array $$\rho\phi z$$. ndarray

Examples

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

colour.algebra.coordinates.cylindrical_to_cartesian(a)[source]

Transforms given Cylindrical coordinates array $$\rho\phi z$$ (azimuth, radial distance and height) to Cartesian coordinates array $$xyz$$.

Parameters: a (array_like) – Cylindrical coordinates array $$\rho\phi z$$ to transform. Cartesian coordinates array $$xyz$$. ndarray

Examples

>>> a = np.array([3.16227766, 0.32175055, 6.00000000])
>>> cylindrical_to_cartesian(a)
array([ 3.        ,  0.9999999...,  6.        ])