Table of Contents

Handle Transform Matrix by ITransformer

ITransformer contains a transform matrix and a inverse transform matrix. The matrix is 4x4 column-major matrix, which describe the orientation or movement between 3D coordinates.

Several common used interface and class are implemented from ITransformer. The inheritance is shown:

IStaticTransformer is transformer with constant matrix. NoTransform, StaticTranslation and StaticRotation contains transform matrix of identity, translate and rotate respectively. StaticFreeform contains a arbitrary constant transform matrix.

The transform matrix of StaticTranslation is:

\[ M_{StaticTranslate}= \begin{bmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 1 & 0 \\\\ Trans.x & Trans.y & Trans.z & 1 \end{bmatrix} \]

The transform matrix of StaticRotation and DynamicRotation is:

\[ M_{Rotate}= \begin{bmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 1 & 0 \\\\ -Pivot.x & -Pivot.y & -Pivot.z & 1 \end{bmatrix} \cdot \\\\ \begin{bmatrix} Rot_{00}(axis,rad) & Rot_{01}(axis,rad) & Rot_{02}(axis,rad) & 0 \\\\ Rot_{10}(axis,rad) & Rot_{11}(axis,rad) & Rot_{12}(axis,rad) & 0 \\\\ Rot_{20}(axis,rad) & Rot_{21}(axis,rad) & Rot_{22}(axis,rad) & 0 \\\\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \\\\ \begin{bmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 1 & 0 \\\\ Pivot.x & Pivot.y & Pivot.z & 1 \end{bmatrix} \]

Where Pivot is the position of the rotation axis.

Tip

Pivot is a point. However, rotation axis is a line. It means that it causes the same matrix no matter how the pivot is moving along the axis.

IDynamicTransformer is transformer with inconstant transform matrix. IDynamicRegular has a property Step, implied that the transform matrix is one parameter driven. GetSteps(IDynamicRegular[]) and SetSteps(IDynamicRegular[], double[]) provide easy handle of an array of IDynamicRegular objects.

The transform matrix of DynamicTranslation is:

\[ M_{DynamicTranslate}= \begin{bmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 1 & 0 \\\\ Trans.x \cdot Step & Trans.y \cdot Step & Trans.z \cdot Step & 1 \end{bmatrix} \]
Note

In convention, Trans should be normalized.