Skip to content

Trigonometry🍋

angle_between_vectors(v1, v2) 🍋

Compute the angle between two vectors using the dot product.

Parameters:

Name Type Description Default
v1 ndarray

first cartesian vector.

required
v2 ndarray

second cartesian vector.

required

Returns:

Type Description
float

Angle between two vectors in radians.

arithmetic(angle) 🍋

Convert an angle from geographic to arithmetic.

Parameters:

Name Type Description Default
angle float

angle to be converted in radians.

required

Returns:

Type Description
float

arithmetic angle in radians

normalize(a, center) 🍋

(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

Parameters:

Name Type Description Default
a float

angle to be normalized (in radians).

required
center float

center value in radians.

required

Returns:

Type Description
float

normalized angle in radians.

Info

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.

plane_to_dir(azimuth, dip, pitch, deg=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:

Name Type Description Default
azimuth float

azimuth of plane.

required
dip float

dip of plane.

required
pitch float

pitch of plane.

required
deg bool

angle type.

True

Returns:

Type Description
Tuple[float, float]

Returns trend and plunge angles in radians.

rot_x(gamma, deg=True, clockwise=True) 🍋

Rotation againt the X axis.

Parameters:

Name Type Description Default
gamma float

Rotation angle.

required
deg bool

True if theta is in degrees.

True
clockwise bool

if True clockwise, if False counter-clockwise rotation.

True

Returns:

Type Description
ndarray

Rotation matrix.

rot_y(beta, deg=True, clockwise=True) 🍋

Rotation againt the Y axis.

Parameters:

Name Type Description Default
beta float

Rotation angle.

required
deg bool

True if theta is in degrees.

True
clockwise bool

if True clockwise, if False counter-clockwise rotation.

True

Returns:

Type Description
ndarray

Rotation matrix.

rot_z(alpha, deg=True, clockwise=True) 🍋

Rotation againt the Z axis.

Parameters:

Name Type Description Default
alpha float

Rotation angle.

required
deg bool

True if theta is in degrees.

True
clockwise bool

if True clockwise, if False counter-clockwise rotation.

True

Returns:

Type Description
ndarray

Rotation matrix.

rot_zyx(angles, deg=True, clockwise=True) 🍋

Example of a convention.

Parameters:

Name Type Description Default
angles List[float]

Description of parameter angles.

required
deg bool

Description of parameter deg.

True
clockwise bool

Clockwise if set to True, counter-clockwise otherwise.

True

Returns:

Type Description
ndarray

A rotation matrix.

rotational_angles(angles) 🍋

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

Parameters:

Name Type Description Default
angles ~Angles

[azimuth, dip, pitch] or azimuth, all in degrees.

required

Returns:

Type Description
~Angles

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

Back to top