trimesh.voxel.transforms#
- class trimesh.voxel.transforms.Transform(matrix, datastore: DataStore | None = None)#
Bases:
object
Class for caching metadata associated with 4x4 transformations.
The transformation matrix is used to define relevant properties for the voxels, including pitch and origin.
- __init__(matrix, datastore: DataStore | None = None)#
Initialize with a transform.
- Parameters:
matrix ((4, 4) float) – Homogeneous transformation matrix
datastore – If passed store the actual values in a reference to another datastore.
- apply_scale(scale)#
Mutate the transform in-place and return self.
- apply_transform(matrix)#
Mutate the transform in-place and return self.
- apply_translation(translation)#
Mutate the transform in-place and return self.
- copy()#
- property inverse_matrix#
- inverse_transform_points(points)#
Apply the inverse transformation to points (not in-place).
- property is_identity#
Flags this transformation being sufficiently close to eye(4).
- property matrix#
Get the homogeneous transformation matrix.
- Returns:
matrix – Transformation matrix
- Return type:
(4, 4) float
- property pitch#
- property scale#
Get the scale factor of the current transformation.
- Returns:
scale – Scale factor from the matrix
- Return type:
(3,) float
- transform_points(points)#
Apply the transformation to points (not in-place).
- Parameters:
points ((n, 3) float) – Points in cartesian space
- Returns:
transformed – Points transformed by matrix
- Return type:
(n, 3) float
- property translation#
Get the translation component of the matrix
- Returns:
translation – Cartesian translation
- Return type:
(3,) float
- property unit_volume#
Volume of a transformed unit cube.