Table of Contents

Class StackTransformer

Namespace
Hi.Mech.Topo
Assembly
HiMech.dll

Represents a transformer that maintains a stack of transformations.

public class StackTransformer : ITransformer, IMakeXmlSource, IDisposable
Inheritance
StackTransformer
Implements
Inherited Members
Extension Methods

Constructors

StackTransformer()

Initializes a new instance of the StackTransformer class.

public StackTransformer()

StackTransformer(params ITransformer[])

Initializes a new instance of the StackTransformer class with the specified transformers.

public StackTransformer(params ITransformer[] transformers)

Parameters

transformers ITransformer[]

A variable-length array of transformers to add to the stack.

StackTransformer(XElement, string)

Initializes a new instance of the StackTransformer class from XML data.

public StackTransformer(XElement src, string baseDirectory)

Parameters

src XElement

The XML element containing the transformer stack configuration.

baseDirectory string

The base directory for resolving relative paths.

Properties

Count

Gets the number of transformers in the stack.

public int Count { get; }

Property Value

int

XName

Static name.

public static string XName { get; }

Property Value

string

Methods

Clear()

Removes all transformers from the stack.

public void Clear()

Clone()

Creates a deep copy of this transformer stack.

public ITransformer Clone()

Returns

ITransformer

A new StackTransformer instance with cloned transformers.

Remarks

The children ITransformer on stack are all cloned.

Dispose()

Releases all resources used by the StackTransformer.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the StackTransformer and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetMat()

Gets the combined transformation matrix of all transformers in the stack.

public Mat4d GetMat()

Returns

Mat4d

The combined 4x4 transformation matrix.

Remarks

The transformations are applied in order from bottom to top of the stack.

GetMatInv()

Gets the inverse of the combined transformation matrix of all transformers in the stack.

public Mat4d GetMatInv()

Returns

Mat4d

The inverse of the combined 4x4 transformation matrix.

Remarks

The inverse transformations are applied in reverse order (top to bottom of the stack). If forward mats is ABCD, then the inv-mats: DinvCinvBinvAinv.

GetStack()

Get the copied transformer stack.

public List<ITransformer> GetStack()

Returns

List<ITransformer>

copied stack

MakeXmlSource(string, string)

Creates an XML representation of this transformer stack.

public virtual XElement MakeXmlSource(string baseDirectory, string relFile)

Parameters

baseDirectory string

The base directory for resolving relative paths.

relFile string

The relative file path for XML serialization.

Returns

XElement

An XML element containing the transformer stack configuration.

Peek()

Returns the transformer at the top of the stack without removing it.

public ITransformer Peek()

Returns

ITransformer

The transformer at the top of the stack, or null if the stack is empty.

Pop()

Removes and returns the transformer at the top of the stack.

public ITransformer Pop()

Returns

ITransformer

The transformer at the top of the stack, or null if the stack is empty.

Push(ITransformer)

Pushes a transformer onto the stack.

public void Push(ITransformer transformer)

Parameters

transformer ITransformer

The transformer to push.