Class TransformBuilder

TransformBuilder class

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

public class TransformBuilder

Constructors

NameDescription
TransformBuilder(ComposeOrder)Construct a TransformBuilder with initial identity transform matrix and specified compose order
TransformBuilder(Matrix4, ComposeOrder)Construct a TransformBuilder with initial transform matrix and specified compose order

Properties

NameDescription
ComposeOrder { get; set; }Gets or sets the chain compose order.
Matrix { get; set; }Gets or sets the current matrix value

Methods

NameDescription
Append(Matrix4)Append the new transform matrix to the transform chain.
Compose(Matrix4)Append or prepend the argument to internal matrix.
Prepend(Matrix4)Prepend the new transform matrix to the transform chain.
Rearrange(Axis, Axis, Axis)Rearrange the layout of the axis.
Reset()Reset the transform to identity matrix
Rotate(Quaternion)Chain a rotation by a quaternion
RotateDegree(double, Vector3)Chain a rotation transform in degree
RotateDegree(Vector3, RotationOrder)Append rotation with specified order
RotateEulerDegree(double, double, double)Chain a rotation by Euler angles in degree
RotateEulerRadian(Vector3)Chain a rotation by Euler angles in radian
RotateEulerRadian(double, double, double)Chain a rotation by Euler angles in radian
RotateRadian(double, Vector3)Chain a rotation transform in radian
RotateRadian(Vector3, RotationOrder)Append rotation with specified order
Scale(double)Chain a scaling transform matrix with a component scaled by s
Scale(Vector3)Chain a scale transform
Scale(double, double, double)Chain a scaling transform matrix
Translate(Vector3)Chain a translation transform
Translate(double, double, double)Chain a translation transform

Examples

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

TransformBuilder tb = new TransformBuilder();
tb.Translate(10, 20, 0);
tb.Scale(10, 10, 10);
tb.RotateEulerDegree(90, 0, 0);
Console.WriteLine($"Transform Matrix: {tb.Matrix}");

See Also