pchandler.geometry.transforms

Transforms module for pchandler.geometry.

Provides helper functions for transforming point clouds and converting between coordinate systems.

Classes

Transform

Point-cloud transformation-array class (4x4 affine).

class pchandler.geometry.transforms.Transform

Bases: _Transform4x4

Point-cloud transformation-array class (4x4 affine).

Parameters:

arr (Array_4x4_T) – 4x4 affine transformation matrix.

__init__(arr, **kwargs)

Initialize a Transform from a 4x4 array or compatible source.

Parameters:
  • arr (Array_Float_T or Array_4x4_T or Self) – Input array or object used for initialization.

  • **kwargs – Additional keyword arguments forwarded to the base class.

classmethod from_translation(vector)

Build a Transform from a translation vector.

Parameters:

vector (Vector_3_T) – Translation vector.

Returns:

Affine transform applying vector.

Return type:

Transform

classmethod from_rotation(matrix)

Build a Transform from a 3x3 rotation matrix.

Parameters:

matrix (Array_3x3_T) – 3x3 rotation matrix.

Returns:

Affine transform applying matrix.

Return type:

Transform

classmethod from_affine(matrix)

Build a Transform from a 4x4 affine matrix.

Parameters:

matrix (Array_4x4_T) – 4x4 affine transformation matrix.

Returns:

Transform wrapping the supplied matrix.

Return type:

Transform

classmethod from_scale(vector)

Build a Transform from a scale vector or uniform scalar.

Parameters:

vector (Vector_3_T or float) – If a scalar (float) is provided, uniform scaling is applied to all dimensions.

Returns:

Affine transform applying the requested scale.

Return type:

Transform

classmethod generate(rotation=np.eye(3), translation=np.zeros(3), scale=1)

Generate an affine transformation from rotation, translation, and/or scale parameters.

Takes the form x0 = (R * s + t) @ x1

Rotation Translation Scale: | R 0 | | I t | | s 0 | | 0 1 | | 0 1 | | 0 1 |

Parameters:
  • rotation (Array_3x3_T, optional) – 3x3 rotation matrix

  • translation (Vector_3_T, optional) – 3-dimensional translation vector

  • scale (Vector_3_T or float, optional) – Scalar value or 3-dimensional vector

Return type:

Transform