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 \\\\ Axis.x \cdot Step & Axis.y \cdot Step & Axis.z \cdot Step & 1 \end{bmatrix} \]

Where Axis is the direction of travel and Step is Len, the distance travelled along it.

Note

Keep Axis a unit vector. The transformer moves by Axis × Step, so a machine axis reads in millimetres only when its axis has unit length; a longer or shorter vector scales every move on that axis. Trans is an offset and keeps its length.

Where a Transformer Lives

A transformer is not held by a part directly: it sits on a Branch, as Transformer. To read or replace the transformer between two anchors, take the branch that joins them with Get(API) — where a fixture's geometry sits relative to its table mount, or a workpiece's program zero relative to its geometry — as a mission script, where Fixture and Workpiece are the session's parts, writes it:

(Branch.Get(Fixture.GeomAnchor, Fixture.TableMount).Transformer as StaticTranslation).Trans += new vec3d_t(0, 0, 10);
Branch.Get(Workpiece.GeomAnchor, Workpiece.ProgramZeroAnchor).Transformer = transform;
Note

Trans, Axis / Pivot, Axis / Pivot and Axis are properties: assign a whole vector, as above — st.Trans.Z += 10 is compile error CS1612, in a mission script too. And a transformer object is the live view of the one branch it sits on: every change made through the object is written to that branch. Putting the same object on a second branch moves it there — the first branch keeps the value it had and stops following the object — so two branches that should start alike each take their own Clone.

Branch.Get answers null when no branch runs between the two anchors, so a topology edited into another shape needs the branch that actually joins them. A pose between two anchors that are not directly joined is a product along the chain, TryGetMat4d (for example TryGetGeomToProgramZeroMat4d; both answer false when no chain connects the anchors). Between parts, the one attachment branch carrying a transformer is the worktable attachment, TableToComp; the others are plain coincidence — see Assembly Anchors.

A branch marked as an error term (IsErrorTerm) carries an error of the real machine on one of the IStaticTransformer kinds — the editor refuses a dynamic one, since an error holds a fixed value and no axis drives it. The controller reads that branch as NoTransform; the runtime face (MachiningEquipment, the equipment a run moves) reads it as No Transform too while the project's error-term switch is off; the authored face (SetupEquipment) and the saved file keep its value either way. See Error-Term Branches.

See Also

  • Kinematic Topology — the anchors and branches these matrices move
  • Assembly Anchors — the role anchors between which a part's transformers are looked up
  • Transform Picker — the app control that puts one of these transforms on a geometry
  • Machine Chain Code — the notation for a machine's structure, whose axis branches carry these transformers