Skip to content

pywellgeo.transformations

pywellgeo.transformations.coordinate_transformation.CoordinateTransformation

class to support coordinate transformations

transformation is determined by rotated basis and global origin spec

the transformed and rotated basis is based on

x(local) = R T x(global)

  • x = homogeneous coordinates (x,y,z,1)
  • T = 4x4 translation matrix. This is a diagonal unit matrix with in the fourth column the translation components -ox,-oy,-oz , where ox,oy,oz is the orogin
  • R = 4x4 unit matrix, where 3x3 first rows and columns is the rotation matrix.

It contains in the rows the unit axes (in global coordinate system orientation)

The initialization is performed in two possible manners:

  • from a definition of the plane for the local coordinates (containing two of the axes), and direction of the first axis. The plane and first axis are defined by spherical coordinates azimdip and the pitch of the first axis in the plane (the third corresponds to the normal to the plane and the second to the outer product of the thrid and first)

  • from a rotated axis framework where the first two unit vectors are given

The backrotation is performed by using the inverse of RT

  • x(global) = (RT)-1 x(local)

__init__

__init__(
    plane: AzimDip,
    origin: ndarray = np.asarray([0, 0, 0]),
    pitch: Union[float64, int] = 0,
) -> None

initialize the coordinate transformation

:param plane: spherical coordinates of the plane to use, azim/dip is the reference direction for the x-axis for pitch is 0 y-axis is in the plane (90 degrees anticlockwise), z-axis is pointing upward

:param origin: of the local coordinate system

:param pitch: rotation clockwise of the local x-axis in the plane relative to the azim-dip, for pitch=0, 90/0 in local coordinates corresponds to the plane azim/dip in global coordinates for pitch=90, 0/0 in local coordinates corresponds to the plane azim/dip in global coordinates

transform2local

transform2local(vglobal: ndarray) -> ndarray

transform a vector from global to local coordinates

:param vglobal: np array with 3 elements representing the vector in global coordinates :return: np array with 3 elements representing the vector in local coordinates

transform2global

transform2global(vlocal: ndarray) -> ndarray

transform a vector from local to global coordinates

:param vlocal: np array with 3 elements representing the vector in local coordinates :return: np array with 3 elements representing the vector in global coordinates

transform2local_orientation

transform2local_orientation(azimdip: AzimDip) -> AzimDip

transform an orientation from global to local coordinates

:param azimdip: AzimDip object representing the orientation in global coordinates :return: local AzimDip object representing the orientation in local coordinates

transform2global_orientation

transform2global_orientation(azimdip: AzimDip) -> AzimDip

transform an orientation from local to global coordinates

:param azimdip: AzimDip object representing the orientation in local coordinates :return: global AzimDip object representing the orientation in global coordinates

rotx

rotx(theta)

rotx gives rotation matrix about X axis

:param theta: radians angle for rotation matrix :return: rotation matrix (3x3) representing a rotation of theta radians about the x-axis

roty

roty(theta: float64) -> ndarray

roty gives rotation matrix about X axis

:param theta: radians angle for rotation matrix :return: rotation matrix (3x3) representing a rotation of theta radians about the y-axis

rotz

rotz(theta: float64) -> ndarray

rotz gives rotation matrix about X axis

:param theta: radians angle for rotation matrix :return: rotation matrix (3x3) representing a rotation of theta radians about the z-axis

plane_pitch_from_vectors classmethod

plane_pitch_from_vectors(
    vecx: ndarray, vec2: ndarray
) -> Union[Tuple[AzimDip, int], Tuple[AzimDip, float64]]

get the plane and pitch from two vectors, sharing the origin as starting point

:param vecx (np array) the first vector and x-axis orientation
:param vec2 (np array) the second vector in the plane
:return: Azimdip object representing the plane and the pitch of the x-axis in the plane

line_plane_intersect

line_plane_intersect(
    ad_ray: AzimDip, rayPoint: ndarray
) -> ndarray

calculate the intersection of line (shooting from raypoint in ad_ray direction) and the plane of self

:param ad_ray: AzimDip object representing the direction of the line :param rayPoint: np array representing the starting point of the line

:return: intersection point in the coordinate-system of self(its x,y,z coordinates)

planes_intersect

planes_intersect(b_t)

calculate the intersection of the two basis planes of the transformation.

:param b_t: CoordinateTransformation object representing the other basis

return: intersection point and AzimDip of orientation of intersection, if