geolime.utilities.trigonometry

Data:

List

The central part of internal API.

Functions:

angle_between_vectors(v1, v2)

Compute the angle between two vectors using the dot product

arithmetic(angle)

Convert an angle from geographic to arithmetic

norm(x[, ord, axis, keepdims])

Matrix or vector norm.

normalize(a, center)

(Adapted from Apach Commons normalizeAngle, MathUtils sources) Normalize an angle in a 2pi; wide interval around a center value.

rot_x(gamma[, deg, clockwise])

Rotation againt the X axis

rot_y(beta[, deg, clockwise])

Rotation againt the Y axis

rot_yxz(angles[, deg, clockwise])

Example of a convention

rot_z(alpha[, deg, clockwise])

Rotation againt the Z axis

rot_zyx(angles[, deg, clockwise])

Example of a convention (RGeoStats)

geolime.utilities.trigonometry.angle_between_vectors(v1: numpy.ndarray, v2: numpy.ndarray)

Compute the angle between two vectors using the dot product

Parameters
  • v1 (np.ndarray) – first cartesian vector

  • v2 (np.ndarray) – second cartesian vector

Returns

angle between two vectors in radians

Return type

float

geolime.utilities.trigonometry.arithmetic(angle: float)

Convert an angle from geographic to arithmetic

Parameters

angle (float) – angle to be converted in radians

Returns

arithmetic angle in radians

Return type

float

geolime.utilities.trigonometry.normalize(a: float, center: float)

(Adapted from Apach Commons normalizeAngle, MathUtils sources) Normalize an angle in a 2pi; wide interval around a center value. This method has three main uses: * normalize an angle between 0 and 2pi: a = normalize(a, np.pi) * normalize an angle between -pi and +pi: a = normalize(a, 0.0) * compute the angle between two defining angular positions: angle = normalize(end, start) - start

Note that due to numerical accuracy and since pi; cannot be represented exactly, the result interval is closed, it cannot be half-closed as would be more satisfactory in a purely mathematical view.

Parameters
  • a (float) – angle to be normalized (in radians)

  • center (float) – center value in radians

Returns

normalized angle in radians

Return type

float

geolime.utilities.trigonometry.rot_x(gamma: float, deg: bool = True, clockwise: bool = True)

Rotation againt the X axis

Parameters
  • gamma (float) – Rotation angle

  • deg (bool) – True if theta is in degrees

  • clockwise (bool) – if True: clockwise, if False: counter-clockwise rotation

Returns

Rotation matrix

Return type

np.ndarray

geolime.utilities.trigonometry.rot_y(beta: float, deg: bool = True, clockwise: bool = True)

Rotation againt the Y axis

Parameters
  • beta (float) – Rotation angle

  • deg (bool) – True if theta is in degrees

  • clockwise (bool) – if True: clockwise, if False: counter-clockwise rotation

Returns

Rotation matrix

Return type

np.ndarray

geolime.utilities.trigonometry.rot_yxz(angles: List[float], deg: bool = True, clockwise: bool = True)

Example of a convention

Parameters
  • angles (List[float]) – Description of parameter angles.

  • deg (float) – Description of parameter deg.

  • clockwise (bool) – Clockwise if set to True, counter-clockwise otherwise

Returns

A rotation matrix

Return type

np.ndarray

geolime.utilities.trigonometry.rot_z(alpha: float, deg: bool = True, clockwise: bool = True)

Rotation againt the Z axis

Parameters
  • alpha (float) – Rotation angle

  • deg (bool) – True if theta is in degrees

  • clockwise (bool) – if True: clockwise, if False: counter-clockwise rotation

Returns

Rotation matrix

Return type

np.ndarray

geolime.utilities.trigonometry.rot_zyx(angles: List[float], deg: bool = False, clockwise: bool = True)

Example of a convention (RGeoStats)

Parameters
  • angles (List[float]) – Description of parameter angles.

  • deg (float) – Description of parameter deg.

  • clockwise (bool) – Clockwise if set to True, counter-clockwise otherwise

Returns

A rotation matrix

Return type

np.ndarray