Table of Contents

Class TransformationUtil

Namespace
Hi.NcParsers.Syntaxs
Assembly
HiMech.dll

Utilities for the ProgramToMcTransform chain. Each entry has “Source” (string) and “Mat4d” (16-element JsonArray). AddOrReplaceTransform(JsonObject, string, Mat4d) inserts or replaces an entry by source name. GetComposedTransform(JsonObject) composes all entries into a single Mat4d.

public static class TransformationUtil
Inheritance
TransformationUtil
Inherited Members

Fields

Mat4dKey

public const string Mat4dKey = "Mat4d"

Field Value

string

SourceKey

public const string SourceKey = "Source"

Field Value

string

Methods

AddOrReplaceTransform(JsonObject, string, Mat4d)

Adds or replaces a named 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

json JsonObject
source string
mat Mat4d

GetComposedTransform(JsonObject)

Composes all entries in the chain into a single Mat4d (left-to-right multiplication). Returns identity if chain is empty or absent.

public static Mat4d GetComposedTransform(JsonObject json)

Parameters

json JsonObject

Returns

Mat4d

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

json JsonObject
source string

Returns

Mat4d

GetVec3d(JsonObject, string, Vec3d)

Reads a Vec3d from a sub-object with X/Y/Z keys. Returns fallback if not present.

public static Vec3d GetVec3d(JsonObject json, string sectionKey, Vec3d fallback)

Parameters

json JsonObject
sectionKey string
fallback Vec3d

Returns

Vec3d

SetVec3d(JsonObject, string, Vec3d)

Writes a Vec3d as a sub-object with X/Y/Z keys.

public static void SetVec3d(JsonObject json, string sectionKey, Vec3d v)

Parameters

json JsonObject
sectionKey string
v Vec3d