Table of Contents

Class GeneralTransform

Namespace
Hi.Mech.Topo
Assembly
HiMech.dll

Represents a general transformation that combines scaling, rotation, and translation.

public class GeneralTransform : IStaticTransformer, ITransformer, IMakeXmlSource, IGetInverseTransformer, IToPresentDto
Inheritance
GeneralTransform
Implements
Inherited Members
Extension Methods

Constructors

GeneralTransform()

Initializes a new instance of the GeneralTransform class.

public GeneralTransform()

GeneralTransform(mat4d_t)

Initializes a new instance of the GeneralTransform class from a 4x4 transformation matrix.

public GeneralTransform(mat4d_t mat)

Parameters

mat mat4d_t

The transformation matrix.

GeneralTransform(double, StaticRotation, StaticTranslation)

Initializes a new instance of the GeneralTransform class with specified scale, rotation, and translation.

public GeneralTransform(double scale, StaticRotation rotation, StaticTranslation translation)

Parameters

scale double

The scaling factor.

rotation StaticRotation

The rotation transformation.

translation StaticTranslation

The translation transformation.

GeneralTransform(XElement)

Ctor.

public GeneralTransform(XElement src)

Parameters

src XElement

XML

Properties

Rotation

2th transform.

public StaticRotation Rotation { get; }

Property Value

StaticRotation

Scale

1th transform.

public double Scale { get; set; }

Property Value

double

Translation

3th transform.

public StaticTranslation Translation { get; }

Property Value

StaticTranslation

XName

Static name.

public static string XName { get; }

Property Value

string

Methods

Clone()

Clones this instance.

public ITransformer Clone()

Returns

ITransformer

clone

Remarks

Rotation and Translation are cloned too: a transformer routes its changes to the branch it is bound to through the transformer it is nested in, so the clone must not take the originals over.

GetInverseTransformer()

Gets the inverse transformer of this transformer.

public ITransformer GetInverseTransformer()

Returns

ITransformer

The inverse transformer.

Remarks

The inverse of scale, then rotation about the pivot, then translation is the same three in the same order with 1 / Scale, the angle negated about (pivot + translation) / scale, and the translation -translation / scale. Before 2026-10-03 the pivot and translation were not divided by the scale, which was the inverse only at scale 1.

GetMat()

Gets the transform matrix.

public mat4d_t GetMat()

Returns

mat4d_t

The transform matrix.

GetMatInv()

Gets the inverse transform matrix.

public mat4d_t GetMatInv()

Returns

mat4d_t

The inverse transform matrix.

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public virtual XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.

Reg(XFactory)

Registers this type's deserializer with the given XFactory and chains Reg(factory) on dependents. Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory

ToPresentDto()

Convert GeneralTransform to presentation DTO (Data Transfer Object) for JSON serialization. The returned object includes type metadata for web API presentation.

public object ToPresentDto()

Returns

object

DTO dictionary with Type, Scale, Rotation, and Translation keys