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.

plane_to_dir(azimuth, dip, pitch[, deg])

Convert plane angles to line angles.

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)

rotational_angles(angles)

Compute the angles in radians necessary for matrix rotation operation from geographic azimuth, dip and pitch angles defined in degrees

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.plane_to_dir(azimuth: float, dip: float, pitch: float, deg: bool = True)

Convert plane angles to line angles. For experimental variography, we check the pairs of distances along a direction and not a plane. When considering direction, we only have to compute the angle between a unit direction vector with the pairs direction (refer to the angle_between_vectors function)

Parameters
  • azimuth (float) – azimuth of plane

  • dip (float) – dip of plane

  • pitch (float) – pitch of plane

  • deg (bool) – optional argument, degrees by default

Returns

Returns trend and plunge angles in radians

Return type

float, 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 = True, 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

geolime.utilities.trigonometry.rotational_angles(angles: Union[float, List[float]])

Compute the angles in radians necessary for matrix rotation operation from geographic azimuth, dip and pitch angles defined in degrees

Parameters

angles (float or List of float) – [azimuth, dip, pitch] or azimuth, all in degrees

Returns

Returns angles in radians ready to be piped into rotation transforms.

Return type

List[float] or float