The coordinates module

Tools for performing vector and coordinate conversions.

Functions

src.tools.coordinates.sphericalToCartesian(magnitude, azimuthal, polar)[source]

Convert a vector from spherical to Cartesian coordinates.

Parameters :

magnitude : float

The magnitude of the vector.

azimuthal : float

The angle in degrees of the vector, measured downward from the positive z-axis.

polar : float

The angle in degrees of the vector, measured counter-clockwise from the positive x-axis.

Returns :

float :

The x-coordinate of the vector.

float :

The y-coordinate of the vector.

float :

THe z-coordinate of the vector.

src.tools.coordinates.cartesianToSpherical(xComp, yComp, zComp, negateMagnitude=False, tolerance=1e-10)[source]

Convert a vector from Cartesian to spherical coordinates.

Parameters :

xComp : float

The x-component of the vector.

yComp : float

The y-component of the vector.

zComp : float

The z-component of the vector.

negateMagnitude : bool

Whether to prefer a negative value of the magnitude, accounting for the reversed direction by adding 180 degrees to the azimuthal angle.

tolerance : float

How maximum absolute value a number may have and still be treated as zero.

Returns :

float :

The magnitude of the vector.

float :

The azimuthal angle in degrees.

float :

The polar angle in degrees.

src.tools.coordinates.equalEnough(numA, numB, tol=1e-06)[source]

Return whether two numbers are close enough to be considered equal.

src.tools.coordinates.clean(point)[source]

Return a float with digits farther out than fifth place truncated.

Table Of Contents

Previous topic

The subversion module

Next topic

The expt_loader module

This Page