colour.algebra.coordinates.transformations Module — Colour 0.3.0 documentation

# colour.algebra.coordinates.transformations Module

## Coordinates System Transformations

Defines objects to apply transformations on coordinates systems.

The following transformations are available:

- `cartesian_to_spherical()`: Cartesian to Spherical transformation.
- `spherical_to_cartesian()`: Spherical to Cartesian transformation.
- `cartesian_to_cylindrical()`: Cartesian to Cylindrical transformation.
- `cylindrical_to_cartesian()`: Cylindrical to Cartesian transformation.

References

[1] | http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations

`colour.algebra.coordinates.transformations.` `cartesian_to_spherical`(vector)

  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

  See also

  `spherical_to_cartesian()`, `cartesian_to_cylindrical()`, `cylindrical_to_cartesian()`

  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)

  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

  See also

  `cartesian_to_spherical()`, `cartesian_to_cylindrical()`, `cylindrical_to_cartesian()`

  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)

  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

  See also

  `cartesian_to_spherical()`, `spherical_to_cartesian()`, `cylindrical_to_cartesian()`

  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)

  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

  See also

  `cartesian_to_spherical()`, `spherical_to_cartesian()`, `cartesian_to_cylindrical()`

  Examples

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