Class TriTree
A wrapper provides native tree-grid-based structure. It wraps NativeStl.
public class TriTree : IDisposable, IGetTriTree, ICollidee, ICollidable, IExpandToBox3d, IGetCollidable
- Inheritance
-
TriTree
- Implements
- Inherited Members
- Extension Methods
Constructors
TriTree(NativeStl)
Ctor: the tree of nativeStl, with no message sink – a mesh whose triangles were left
out (NonFiniteTriangleCount) is counted, not said.
public TriTree(NativeStl nativeStl)
Parameters
nativeStlNativeStlNative Stl
TriTree(NativeStl, IProgress<IMessage>)
Ctor: the tree of nativeStl; when the native build left triangles out
(NonFiniteTriangleCount not 0) messageProgress is told once, as the
validation warning Collision-TriTree–NonFiniteTrianglesLeftOut carrying that count and
TriangleCount, and the tree's one warning is taken (TakeNonFiniteTrianglesWarning():
a later prepare or detection with a sink says nothing more for it). A null sink is the same as
TriTree(NativeStl): counted, the warning left to a later holder.
public TriTree(NativeStl nativeStl, IProgress<IMessage> messageProgress)
Parameters
nativeStlNativeStlNative Stl
messageProgressIProgress<IMessage>Sink-agnostic message host for the warning; null: counted, not said.
Properties
NativeStl
For internal.
public NativeStl NativeStl { get; set; }
Property Value
NonFiniteTriangleCount
The triangles of the STL with an apex coordinate that is not a number or is infinite, which the native
build left out of the tree and of its bounding box (CppCore tri_tree_t::non_finite_tris_n, since
2026-11-06): such a triangle takes no part in any collision answer, and the box the two collision checks
compare before they walk is finite whenever the tree holds a triangle. Before, such a triangle was placed in
every cell of its axis down to level 15 (8^15 nodes for a triangle whose every coordinate is NaN) and the
build exhausted memory. 0 for a mesh of finite triangles. TriTree(NativeStl, IProgress<IMessage>)
says Collision-TriTree–NonFiniteTrianglesLeftOut when it is not 0; a chain's solids, whose trees are
built without a sink, are reported with the part's key by HiMech's MechCollisionUtil.PrepareCollidableItems
or, for a tree first built by a detection, by MachiningEquipment.Detect(bool, IProgress<IMessage>) –
once per tree, whichever holder with a sink comes first (TakeNonFiniteTrianglesWarning()).
public long NonFiniteTriangleCount { get; }
Property Value
TriTreePtr
For internal.
public nint TriTreePtr { get; set; }
Property Value
TriangleCount
The number of triangles of the STL the tree was built from (TriangleNum at construction), NonFiniteTriangleCount of them left out of the tree.
public int TriangleCount { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Remarks
If NativeStl is disposed, this object will also be disposed.
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
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 void ExpandToBox3d(ref box3d_t dst)
Parameters
dstbox3d_tDestination box, expanded in place
~TriTree()
protected ~TriTree()
GetCollidable()
Get ICollidable.
public ICollidable GetCollidable()
Returns
- ICollidable
The collidable object.
GetCollidee()
Get ICollidee.
public ICollidee GetCollidee()
Returns
GetTriTree()
Get TriTree.
public TriTree GetTriTree()
Returns
TakeNonFiniteTrianglesWarning()
Takes this tree's one warning about its left-out triangles: true on the first call when
NonFiniteTriangleCount is not 0 – the caller then says the warning – false on every later call,
and always false for a tree that left nothing out. TriTree(NativeStl, IProgress<IMessage>) takes it
when it says Collision-TriTree–NonFiniteTrianglesLeftOut; HiMech's MechCollisionUtil.PrepareCollidableItems
and MachiningEquipment.Detect(bool, IProgress<IMessage>) take it when they say
Collision-Prepare–NonFiniteTrianglesLeftOut with the part's key. So a tree is said once, by whichever
holder has a sink first, and a build without a sink leaves it to be said later. Thread-safe (an interlocked flag).
public bool TakeNonFiniteTrianglesWarning()
Returns
- bool
True once, when there is something to say and nobody has said it; false otherwise.