colour.algebra.coordinates.transformations Module

Coordinates System Transformations

Defines objects to apply transformations on coordinates systems.

The following transformations are available:

References

[1]Wikipedia. (n.d.). List of common coordinate transformations. Retrieved from http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations
colour.algebra.coordinates.transformations.cartesian_to_spherical(a)[source]

Transforms given Cartesian coordinates array to Spherical coordinates.

Parameters:a (array_like) – Cartesian coordinates array (x, y, z) to transform.
Returns:Spherical coordinates array (r, theta, phi).
Return type:ndarray

Examples

>>> a = np.array([3, 1, 6])
>>> cartesian_to_spherical(a)  
array([ 6.7823299...,  1.0857465...,  0.3217505...])
colour.algebra.coordinates.transformations.spherical_to_cartesian(a)[source]

Transforms given Spherical coordinates array to Cartesian coordinates.

Parameters:a (array_like) – Spherical coordinates array (r, theta, phi) to transform.
Returns:Cartesian coordinates array (x, y, z).
Return type:ndarray

Examples

>>> a = np.array([6.78232998, 1.08574654, 0.32175055])
>>> spherical_to_cartesian(a)  
array([ 3.        ,  0.9999999...,  6.        ])
colour.algebra.coordinates.transformations.cartesian_to_cylindrical(a)[source]

Transforms given Cartesian coordinates array to Cylindrical coordinates.

Parameters:a (array_like) – Cartesian coordinates array (x, y, z) to transform.
Returns:Cylindrical coordinates array (z, theta, rho).
Return type:ndarray

Examples

>>> a = np.array([3, 1, 6])
>>> cartesian_to_cylindrical(a)  
array([ 6.        ,  0.3217505...,  3.1622776...])
colour.algebra.coordinates.transformations.cylindrical_to_cartesian(a)[source]

Transforms given Cylindrical coordinates array to Cartesian coordinates.

Parameters:a (array_like) – Cylindrical coordinates array (z, theta, rho) to transform.
Returns:Cartesian coordinates array (x, y, z).
Return type:ndarray

Examples

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