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(vector)[source]

Transforms given Cartesian coordinates vector to Spherical coordinates.

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

Examples

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

Transforms given Spherical coordinates vector to Cartesian coordinates.

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

Examples

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

Transforms given Cartesian coordinates vector to Cylindrical coordinates.

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

Examples

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

Transforms given Cylindrical coordinates vector to Cartesian coordinates.

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

Examples

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