Table of Contents

Class Anchor

Namespace
Hi.Mech.Topo
Assembly
HiMech.dll

A coordinate system using in kinematic chain.

An anchor is a view (world, id) over a node of the native topology registry (core.dll, Hi.Mech.Topo.NativeTopo): its GUID, parent and branch maps live on the native node and every walk over the branch graph runs there under the registry's lock; the name is cached on the view and pushed to the node on set, as the view is the node's only writer. The Hi.Mech.Topo.TopoWorld keeps the connected component allocated while any view into it is reachable, and the same native id always resolves to the same view object, so an anchor remains a sound dictionary key and ReferenceEquals comparand.

public class Anchor : IAnchoredDisplayee, IGetAnchor, IGetTopoIndex, IDisplayee, IExpandToBox3d
Inheritance
Anchor
Implements
Inherited Members
Extension Methods

Constructors

Anchor()

Ctor: an anchor belonging to no assembly, the root of a world of its own until it is added or attached somewhere.

public Anchor()

Anchor(Asmb)

Ctor.

public Anchor(Asmb asmb)

Parameters

asmb Asmb

add this to asmb by Add(Anchor)

Anchor(Asmb, string)

Ctor.

public Anchor(Asmb asmb, string name)

Parameters

asmb Asmb

add this to asmb by Add(Anchor)

name string

Name

Properties

BranchMap

Gets a snapshot of the branches departing from this anchor, keyed by their Arrow. ‘this’ anchor locates on Fletch.

public Dictionary<Anchor, Branch> BranchMap { get; }

Property Value

Dictionary<Anchor, Branch>

BranchMapInv

Gets a snapshot of the branches arriving at this anchor, keyed by their Fletch. ‘this’ anchor locates on Arrow.

public Dictionary<Anchor, Branch> BranchMapInv { get; }

Property Value

Dictionary<Anchor, Branch>

Guid

GUID.

public Guid Guid { get; }

Property Value

Guid

IndexXName

The XML element name used for indexing anchors.

public static string IndexXName { get; }

Property Value

string

IndexXml

Get XML for indexing. Only the Guid takes effect when reading.

public XElement IndexXml { get; }

Property Value

XElement

The XML contains Name and Guid.

Name

Name.

public string Name { get; set; }

Property Value

string

Parent

The assembly this anchor belongs to; null while it belongs to none. An anchor belongs to at most one assembly at a time. Maintained by Add(Anchor) and Remove(Anchor).

public Asmb Parent { get; }

Property Value

Asmb

Methods

Ancestors()

The assemblies enclosing this anchor, nearest first.

public IEnumerable<Asmb> Ancestors()

Returns

IEnumerable<Asmb>

ConnectedAnchors()

Every anchor reachable from this one over branches, this one included, regardless of which assemblies they belong to.

public HashSet<Anchor> ConnectedAnchors()

Returns

HashSet<Anchor>

Detach()

Detach all related Branch.

public void Detach()

Display(Bind)

Display function called in DispEngine rendering loop.

public void Display(Bind bind)

Parameters

bind Bind

Bind with DispEngine. See Bind.

ExpandToBox3d(ref box3d_t)

Expands the destination box. This function is usually used to compute the bounding box of elements. box3d_t is a value type, so the destination is passed by reference (the C++ expand_to_box3d(box3&) shape); an implementation writes dst = dst.Expanded(...) or forwards ref dst to its parts.

public virtual void ExpandToBox3d(ref box3d_t dst)

Parameters

dst box3d_t

Destination box, expanded in place

GetAnchor()

Get key anchor. (i.e. root anchor)

public Anchor GetAnchor()

Returns

Anchor

key anchor

GetByIndexXml(XElement, Dictionary<Guid, Anchor>)

Gets an anchor from its XML index representation using a GUID-to-Anchor dictionary.

public static Anchor GetByIndexXml(XElement src, Dictionary<Guid, Anchor> guidToAncDictionary)

Parameters

src XElement

The source XML element containing the anchor index information.

guidToAncDictionary Dictionary<Guid, Anchor>

Dictionary mapping GUIDs to Anchor objects.

Returns

Anchor

The anchor object corresponding to the XML index.

GetMat4dMap()

Gets the transform of every anchor in ConnectedAnchors(), expressed in this anchor's coordinate; this anchor first, at identity.

public Dictionary<Anchor, mat4d_t> GetMat4dMap()

Returns

Dictionary<Anchor, mat4d_t>

NeighborAnchors()

The anchors one branch away, in either direction; each once.

public IEnumerable<Anchor> NeighborAnchors()

Returns

IEnumerable<Anchor>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

TryGetMat4d(IGetAnchor, out mat4d_t)

Get transform matrix from this to tail.

public bool TryGetMat4d(IGetAnchor tail, out mat4d_t mat)

Parameters

tail IGetAnchor

tail

mat mat4d_t

transform matrix, when the method returns true; unspecified otherwise

Returns

bool

true with the matrix; false when tail is null or no branch chain connects the two