Package lib :: Package geometry :: Module coord_transform
[hide private]
[frames] | no frames]

Module coord_transform

source code

Module for transforming between different coordinate systems.

Functions [hide private]
numpy rank-1, 3D array
cartesian_to_spherical(vector)
Convert the Cartesian vector [x, y, z] to spherical coordinates [r, theta, phi].
source code
 
spherical_to_cartesian(spherical_vect, cart_vect)
Convert the spherical coordinate vector [r, theta, phi] to the Cartesian vector [x, y, z].
source code
Variables [hide private]
  __package__ = 'lib.geometry'

Imports: acos, atan2, cos, sin, array, float64, norm


Function Details [hide private]

cartesian_to_spherical(vector)

source code 

Convert the Cartesian vector [x, y, z] to spherical coordinates [r, theta, phi].

The parameter r is the radial distance, theta is the polar angle, and phi is the azimuth.

Parameters:
  • vector (numpy rank-1, 3D array) - The Cartesian vector [x, y, z].
Returns: numpy rank-1, 3D array
The spherical coordinate vector [r, theta, phi].

spherical_to_cartesian(spherical_vect, cart_vect)

source code 

Convert the spherical coordinate vector [r, theta, phi] to the Cartesian vector [x, y, z].

The parameter r is the radial distance, theta is the polar angle, and phi is the azimuth.

Parameters:
  • spherical_vect (3D array or list) - The spherical coordinate vector [r, theta, phi].
  • cart_vect (3D array or list) - The Cartesian vector [x, y, z].