trimesh.voxel.transforms

class trimesh.voxel.transforms.Transform(matrix)

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.

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()
crc()

Get the zlib.adler32 hash of the current transformation matrix.

Returns

crc – Hash of transformation matrix

Return type

str

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

md5()

Get the MD5 hash of the current transformation matrix.

Returns

md5 – Hash of transformation matrix

Return type

str

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.