Skip to main content

Module mesh_solid

Module mesh_solid 

Source
Expand description

A B-rep solid from a triangle mesh.

A mesh already says which triangles meet along which edges: once its repeated vertices are welded, two triangles that share two vertices share an edge. So the topology is built from that connectivity directly (one vertex per mesh vertex, one edge per mesh edge), and no geometric sewing search is needed, which is what keeps a mesh of hundreds of thousands of triangles cheap to convert.

Adjacent triangles that lie in one plane merge into one planar face, bounded by the region’s outer loop and its holes, and a run of boundary segments along one straight line between the same two faces becomes one edge: a cube’s twelve triangles become six faces and twelve edges, and the faces take fillets and chamfers as a modelled box’s do.

Curved regions are recognized: triangles across which the surface turns smoothly are grown into regions for as long as their vertices lie on one cylinder, cone, sphere or torus, verified at the stated tolerance, and the region is rebuilt on that surface. Its boundary with each neighbour is placed on the surface exactly (a parallel circle or a ruling of it), so a meshed bore comes back as a cylinder between two circles, and a band all the way round its axis gets a seam as a modelled one has. A sphere or torus with no boundary is one face, a sphere bounded by one circle a cap, and a band round a torus’s tube runs between two of its meridians. A region whose boundary is no such curve, or that nothing canonical fits, stays faceted.

Windings are made consistent across each connected piece and turned outward. A mesh that does not close (a hole, an edge three triangles share, a piece that cannot be oriented) does not fail: it comes back as open shells, with the report saying why.

Structs§

FitConstraints
What a fit holds fixed.
MeshRegion
One region as found: its triangles, the surface they are built on, and the regions beside it.
MeshRegions
The regions of a mesh, found and not yet built.
MeshSolid
The result of solid_from_mesh.
MeshSolidOptions
How solid_from_mesh builds.
MeshSolidReport
What solid_from_mesh did, and where the mesh does not close.
RegionFallback
A curved region the build faceted, and why: see MeshSolidReport::fallbacks.
RegionId
Names one region of a MeshRegions. A merge keeps the first region’s name and retires the second’s; a split keeps the name for one piece and gives the other a new one.

Enums§

FallbackReason
Why a curved region was built as facets instead of on its surface.
RegionRefusal
Why a step on the regions was refused. The regions are unchanged.
SurfaceKind
A kind of surface to fit to a region with MeshRegions::fit.

Functions§

refine_solid
Rebuild a solid’s faceted stretches on the surfaces they approximate.
single_precision_quantum
How far single-precision storage may have moved a mesh’s vertices: half the spacing of f32 values at its largest coordinate on each axis, over the three axes at once. The quantum of a mesh that went through f32 (a render mesh, a binary STL), for MeshSolidOptions::quantum.
solid_from_mesh
Build a B-rep from a triangle mesh.