Class TopoStl3Hfr
Pure C# topological STL (triangle mesh) with Fraction<decimal> coordinates.
Hfr: High-Precision (decimal) FRaction.
Provides unlimited-precision exact arithmetic for geometric computations
without relying on native (C++) interop.
Corresponds to C++ topo_stl3_t.
public class TopoStl3Hfr : IDisplayee, IExpandToBox3d, IDisposable
- Inheritance
-
TopoStl3Hfr
- Implements
- Inherited Members
- Extension Methods
Constructors
TopoStl3Hfr(Stl, decimal)
Initializes a topological STL from an Stl model.
public TopoStl3Hfr(Stl stl, decimal fractionResolution)
Parameters
TopoStl3Hfr(IReadOnlyList<Vec3Hfr[]>)
Initializes a topological STL from fraction-precision triangles (Vec3Hfr arrays).
Each element is a 3-element array of Vec3Hfr representing triangle apexes.
Corresponds to C++ constructor topo_stl3_t(Tri3fr_Iter, Tri3fr_Iter).
public TopoStl3Hfr(IReadOnlyList<Vec3Hfr[]> tris)
Parameters
trisIReadOnlyList<Vec3Hfr[]>Source triangles as arrays of 3 Vec3Hfr.
TopoStl3Hfr(IReadOnlyList<Tri3d>, decimal)
Initializes a topological STL from double-precision triangles.
Phase 1 (parallel): converts vertices to fraction coordinates via Stern-Brocot approximation.
Phase 2 (sequential): builds topology (stocks, connectivity).
Corresponds to C++ constructor topo_stl3_t(Tri3d_Iter, Tri3d_Iter, double).
public TopoStl3Hfr(IReadOnlyList<Tri3d> tris, decimal fractionResolution)
Parameters
trisIReadOnlyList<Tri3d>Source triangles.
fractionResolutiondecimalFraction approximation resolution (decimal).
TopoStl3Hfr(int)
Initializes an empty topological STL with the specified triangle capacity.
public TopoStl3Hfr(int trisCap)
Parameters
trisCapintExpected number of triangles (for pre-allocation).
Fields
TlStock
The line stock for this topological STL.
public readonly TopoLine3StockHfr TlStock
Field Value
TpStock
The point stock for this topological STL.
public readonly TopoPoint3StockHfr TpStock
Field Value
TtStock
The triangle stock for this topological STL.
public readonly TopoTri3StockHfr TtStock
Field Value
Properties
Count
Gets the number of triangles.
public int Count { get; }
Property Value
FlatDisplayee
Gets the flat-shaded displayee for this topological STL. Created lazily on first access.
public TopoStl3HfrFlatDisplayee FlatDisplayee { get; }
Property Value
Methods
ClearDrawingsCache()
Invalidates all cached displayees. Call this after modifying the topology.
public void ClearDrawingsCache()
Display(Bind)
Displays the topological STL using flat shading. For smooth rendering, use TopoStl3HfrSmoothDisplayee.
public void Display(Bind bind)
Parameters
bindBindThe rendering bind context.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Disposes the cached drawings.
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
ExpandToBox3d(Box3d)
Expands the box to include all points.
public void ExpandToBox3d(Box3d dst)
Parameters
dstBox3d
IsSeamless()
Checks whether the mesh is seamless (all edges have a properly paired reversed line).
A seamless mesh is a necessary condition for a manifold (closed, watertight) geometry.
Corresponds to C++ is_seamless().
public bool IsSeamless()
Returns
- bool
True if every directed edge has a reversed line with a triangle.
IsSeamless(List<TopoLine3Hfr>)
Checks whether the mesh is seamless. Defect lines are output to dstDefectLines.
Corresponds to C++ is_seamless(vector<topo_line3_t*>&).
public bool IsSeamless(List<TopoLine3Hfr> dstDefectLines)
Parameters
dstDefectLinesList<TopoLine3Hfr>Output list for defect (non-seamless) lines.
Returns
- bool
True if the mesh is fully seamless.
ToStl()
Converts to an Stl model.
public Stl ToStl()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToTris()
Converts all triangles to a list of Tri3d (double precision).
Corresponds to C++ to_tris().
public List<Tri3d> ToTris()