Class TransformationUtil
Utilities for the EndPointProgramToMcTransform chain.
Each entry is {Source, Mat4d}; entries are composed in order
with pure matrix multiplication
(GetComposedTransform(JsonObject)). There is no “dynamic”
entry form — every source is a block-endpoint Mat4d snapshot, including
RTCP-specific sources such as PivotTransformSource.
Dynamic-rotary state (for motion-form selection) lives on a dedicated
flag like IsRotaryDynamic,
outside of this chain.
public static class TransformationUtil
- Inheritance
-
TransformationUtil
- Inherited Members
Fields
Mat4dKey
JSON key for the Mat4d snapshot inside each chain entry.
public const string Mat4dKey = "Mat4d"
Field Value
PivotTransformSource
Canonical source name for the RTCP pivot transform — the kinematic transform from Pn (post-G54, post-G68.2) to MC at the block's endpoint ABC. Contributed by G43p4RtcpSyntax (and its brand-specific peers in the future). Should be the last entry in the chain so that all Pn-frame operations (tilt, tool-height, coord-offset) are accumulated before the final kinematic IK.
public const string PivotTransformSource = "PivotTransform"
Field Value
SourceKey
JSON key for the transform origin label inside each chain entry.
public const string SourceKey = "Source"
Field Value
ToolHeightCompensationSource
Canonical source name for the tool-height-compensation entry
(tool-normal · offset_mm along the current tool axis). Matches the
ToolHeightCompensation section key read for
Offset_mm.
public const string ToolHeightCompensationSource = "ToolHeightCompensation"
Field Value
Methods
AddOrMoveToEndTransform(JsonObject, string, Mat4d)
Removes the existing entry for source (if any)
and appends a fresh entry at the end of the chain. Used by sources
that must evaluate last — notably
PivotTransformSource, which represents the final Pn→MC
kinematic IK and therefore has to come after all Pn-frame
contributions (tilt, tool-height, coord-offset).
public static void AddOrMoveToEndTransform(JsonObject json, string source, Mat4d mat)
Parameters
jsonJsonObjectsourcestringmatMat4d
AddOrReplaceTransform(JsonObject, string, Mat4d)
Adds or replaces a named static transformation entry in the chain. If an entry with the same source already exists, it is replaced in-place. Otherwise the new entry is appended.
public static void AddOrReplaceTransform(JsonObject json, string source, Mat4d mat)
Parameters
jsonJsonObjectsourcestringmatMat4d
GetComposedTransform(JsonObject)
Composes all entries in the chain into a single block-endpoint Mat4d (left-to-right multiplication). Pure multiplication — no special cases, no kinematic lookup. The returned matrix is valid only for the block's endpoint state; see EndPointProgramToMcTransform for the endpoint-semantic contract.
public static Mat4d GetComposedTransform(JsonObject json)
Parameters
jsonJsonObject
Returns
GetTransformBySource(JsonObject, string)
Gets a specific entry's Mat4d by source name. Returns identity if not found.
public static Mat4d GetTransformBySource(JsonObject json, string source)
Parameters
jsonJsonObjectsourcestring
Returns
MakePivotTransformMat(IMachineKinematics, Vec3d)
Builds the PivotTransformSource Mat4d — an
empirically-constructed Pn→MC rigid-affine transform at the block's
endpoint ABC. Equivalent to
kinematics.PnToMc(pn_input, normal).Point when applied to
a Pn-frame point, but expressed as a reusable Mat4d so the chain
stays a pure matrix product (no per-point IK call inside
GetComposedTransform(JsonObject)).
Constructed by probing McToPn(DVec3d) at
the four standard basis points (origin + XYZ unit vectors) at the
target ABC to derive K(abc), and similarly at ABC=0 to derive
K(0); returns K(0) · K(abc).GetInverse(). Topology-
agnostic — works for any affine kinematic chain regardless of axis
order. Legacy PnToMc(DVec3d, out DVec3d) remains the
reference oracle.
public static Mat4d MakePivotTransformMat(IMachineKinematics kinematics, Vec3d abc_rad)
Parameters
kinematicsIMachineKinematicsabc_radVec3d
Returns
MakeToolHeightMat(IMachineKinematics, Vec3d, double)
Builds the tool-height-compensation Mat4d for a given rotary state:
translate by (tool-normal at abc_rad) · height_mm.
Pure translation (no rotation component); combines with the
downstream PivotTransformSource to form the full
Pn→MC IK.
public static Mat4d MakeToolHeightMat(IMachineKinematics kinematics, Vec3d abc_rad, double height_mm)
Parameters
kinematicsIMachineKinematicsabc_radVec3dheight_mmdouble