TransformBuilder class

TransformBuilder class

The TransformBuilder is used to build transform matrix by a chain of transformations.

The TransformBuilder type exposes the following members:

Constructors

ConstructorDescription
__init__(self, initial, order)Construct a TransformBuilder with initial transform matrix and specified compose order
__init__(self, order)Construct a TransformBuilder with initial identity transform matrix and specified compose order

Properties

PropertyDescription
matrixGets or sets the current matrix value
compose_orderGets or sets the chain compose order.

Methods

MethodDescription
scale(self, s)Chain a scaling transform matrix with a component scaled by s
scale(self, x, y, z)Chain a scaling transform matrix
scale(self, s)Chain a scale transform
rotate_degree(self, angle, axis)Chain a rotation transform in degree
rotate_degree(self, rot, order)Append rotation with specified order
rotate_radian(self, angle, axis)Chain a rotation transform in radian
rotate_radian(self, rot, order)Append rotation with specified order
rotate_euler_radian(self, x, y, z)Chain a rotation by Euler angles in radian
rotate_euler_radian(self, r)Chain a rotation by Euler angles in radian
translate(self, tx, ty, tz)Chain a translation transform
translate(self, v)Chain a translation transform
compose(self, m)Append or prepend the argument to internal matrix.
append(self, m)Append the new transform matrix to the transform chain.
prepend(self, m)Prepend the new transform matrix to the transform chain.
rearrange(self, new_x, new_y, new_z)Rearrange the layout of the axis.
rotate(self, q)Chain a rotation by a quaternion
rotate_euler_degree(self, deg_x, deg_y, deg_z)Chain a rotation by Euler angles in degree
reset(self)Reset the transform to identity matrix

Example

The following code shows how to create a matrix by a set of operation

from aspose.threed.utilities import TransformBuilder

tb = TransformBuilder()
tb.translate(10, 20, 0)
tb.scale(10, 10, 10)
tb.rotate_euler_degree(90, 0, 0)
print(f"Transform Matrix: {tb.matrix}")

See Also