Table of Contents

Class NativeTopoStl3d

Namespace
Hi.Geom.Topo
Assembly
HiDisp.dll

Native TopoStl with element type double.

public class NativeTopoStl3d : IDisposable, IDisplayee, IExpandToBox3d
Inheritance
NativeTopoStl3d
Implements
Inherited Members
Extension Methods

Remarks

Thread safe for Display(Bind), DisplaySharpEdges(Bind), GenStl(), Size, CosRoundAngle, ExpandToBox3d(ref box3d_t) and Dispose(): they exclude each other through one lock of the topology, under which Dispose only marks the topology disposed and takes the native pointer, so a display in flight ends before and none reaches the pointer after. Dispose may therefore be called on any thread at any time, a request thread while a canvas is drawing this topology included: the native deletion runs outside that lock - the topology's stocks at once on the calling thread; its two GL meshes at once when their share group died or when the calling thread has a GL context, else on the display thread between frames, as a Drawing's buffer - or, while there is no display thread (before Init(string), after FinishDisp()) or with a core.dll older than the detach export, on the calling thread under a context of its own. That last delete may wait for the process-wide GL context mutex; no Dispose ever waits for it while holding the lock a frame's Display takes. The two displays are called inside a frame or a snapshot, where the calling thread's GL context is current; they make no context of their own for the drawing. TopoStlPtr is read without the lock and is Zero once disposed: whoever hands it to native code keeps the topology alive meanwhile, as before.

Constructors

NativeTopoStl3d(Stl)

Initializes a new instance of the NativeTopoStl3d class.

public NativeTopoStl3d(Stl stl)

Parameters

stl Stl

The STL model to convert to a native topology.

Properties

CosRoundAngle

Gets or sets the cosine of the angle used for rounding. NaN once disposed; a set after Dispose does nothing.

public double CosRoundAngle { get; set; }

Property Value

double

Size

Gets the number of triangles in the native topology.

public int Size { get; }

Property Value

int

TopoStlPtr

Gets the pointer to the native topology structure.

public nint TopoStlPtr { get; }

Property Value

nint

Methods

Display(Bind)

Display function called in DispEngine rendering loop.

public void Display(Bind bind)

Parameters

bind Bind

Bind with DispEngine. See Bind.

DisplaySharpEdges(Bind)

Renders only the edges of the topology.

public void DisplaySharpEdges(Bind bind)

Parameters

bind Bind

The binding context for rendering.

Dispose()

Dispose. May be called on any thread at any time, while a canvas is drawing this topology included (the class remarks): under the topology's lock it only marks the topology disposed and takes the native pointer; the stocks are freed at once on the calling thread, outside the lock, and the two GL meshes at once when stale or when this thread has a context, else on the display thread. A second call does nothing.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

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

dst box3d_t

Destination box, expanded in place

~NativeTopoStl3d()

protected ~NativeTopoStl3d()

GenStl()

Generates an STL model from the native topology.

public Stl GenStl()

Returns

Stl

A new STL model.