Expand description
Repair operations on meshes stored in fast_mesh_store.
Operations read the mesh through a transaction’s tx.mesh(), build the
maps they need from its triangles, compute and validate their whole plan,
and only then write. Positions are read as the stored f32 local
coordinates and all geometry is computed in f64, without the origin.
Every growable temporary is reserved fallibly, so that running out of
memory is OpsError::Store with StoreError::OutOfMemory. Results do
not depend on hash iteration order: every list is sorted explicitly.
- Edges: an undirected edge is keyed
(min, max). It is a boundary edge when one triangle uses it, interior with two and non-manifold with three or more (EdgeKind). Triangles with a repeated vertex id are skipped. - Components: triangles connect through shared edges of any kind
(
Component). - Boundary loops:
boundary_loopschains the boundary edges intoBoundaryLoops by walking each vertex’s triangle fan, so that two holes touching at one vertex come out as two loops. Each loop has a content fingerprint, aLoopId, that callers use to pick loops to fill. - Analysis:
analyzereports a mesh’s defects without changing it, as anAnalysis: loops, coincident vertices, degenerate and duplicate triangles, non-manifold edges and vertices, pinch vertices, components, orientation conflicts and, given a BVH, self-intersection. - Orientation:
orient()makes the winding consistent patch by patch and turns closed components outward. - Booleans:
boolean_plansplits every triangle of mesh A that mesh B crosses (and vice versa) so that each piece lies strictly on one side of the other mesh, classifies the pieces forBooleanOpandapply_booleanwrites the plan, stitching both rims without any winding assumption. Inputs must be closed, manifold and consistently wound. - Offsetting and shells:
offsetmoves a surface along its smooth normals by a signed distance, andshellsolidifies a mesh into a printable shell of wallthicknessby adding a reversed inner copy and stitching every rim; both drop pinched triangles and report them. - Hole filling:
fill_holescloses the boundary loops chosen by size or by id with triangle patches that agree with their neighbours’ winding and never make an edge non-manifold, refined to the surrounding density and faired to continue the surrounding curvature. Runorient()first on meshes that may contain flipped triangles: a hole whose rim crosses an orientation seam is not clean and is skipped. - Auto repair:
auto_repair()runs the standard cleanup pipeline (weld, remove degenerate, orient, remove small components, fill holes) in one transaction, with a report per stage. - Measurement:
measurereports a mesh’s surface area (always) and enclosed volume (when watertight, with the reason otherwise). - Simplification:
simplifyshrinks a mesh toward a target triangle count by quadric-error edge collapses, keeping boundary vertices in place when asked. - Subdivision:
subdividerefines every triangle into four per level by Loop’s scheme, with boundary vertices relaxing along their own curve and other creases holding their midpoints. - Registration:
icp()aligns points to a mesh by rigid, point-to-plane ICP with trimmed outlier rejection, and reports how far it got. - Brush deformation:
inflateandsmoothmove the vertices under a brush along their smooth normals or toward their neighbours, andgrabdrags them along one vector. - UVs: every operation either keeps a mesh’s UV channel aligned or drops
it undoably, never leaving stale values; the per-operation table is in
docs/uv-channel.md.
Re-exports§
pub use append::AppendReport;pub use append::AppendSource;pub use append::append_mesh;pub use append::append_mesh_with_uvs;pub use boolean::BooleanOp;pub use boolean::BooleanPlan;pub use boolean::BooleanReport;pub use boolean::apply_boolean;pub use boolean::boolean_plan;pub use bridge::BridgeOptions;pub use bridge::BridgeOptionsBuilder;pub use bridge::BridgeReport;pub use bridge::bridge_loops;pub use deform::Brush;pub use deform::Falloff;pub use deform::InflateOptions;pub use deform::InflateOptionsBuilder;pub use deform::InflateReport;pub use deform::inflate;pub use icp::IcpMotion;pub use icp::IcpOptions;pub use icp::IcpReport;pub use icp::IcpStatus;pub use icp::icp;pub use icp::sample_surface;
Modules§
- append
- Appending copied geometry to a mesh.
- boolean
- Boolean operations (union, subtract, intersect) between two closed meshes.
- bridge
- Bridging two boundary loops with a triangle tube.
- deform
- Brush deformation: moving vertices along their normals under a falloff.
- icp
- Rigid registration: point-to-plane ICP against a mesh and its BVH.
- remesh
- Region remeshing: matching a brush region’s density to a target edge length.
- simplify
- Mesh simplification by quadric-error edge collapse.
- subdivide
- Mesh subdivision by Loop’s scheme.
Structs§
- Analysis
- What
analyzefound. - Analyze
Options - Options for
analyze. - Analyze
Options Builder - A builder for
AnalyzeOptions, seeAnalyzeOptions::builder. - Auto
Repair Options - Options for
auto_repair(). - Auto
Repair Options Builder - A builder for
AutoRepairOptions, seeAutoRepairOptions::builder. - Auto
Repair Report - What
auto_repair()did, stage by stage. - Boundary
Loop - A chain of boundary edges, closed unless the walk could not close it.
- Component
- A set of triangles connected through shared edges of any kind.
- Component
Options - Options for
remove_small_components(). - Component
Options Builder - A builder for
ComponentOptions, seeComponentOptions::builder. - CutOptions
- Options for
cut_by_plane. - CutOutput
- The
-side ofcut_by_plane: a mesh with the input’s origin, ready to add to the scene with the same placement. - CutReport
- What
cut_by_planedid. - Degenerate
Options - Options for
remove_degenerate(). - Degenerate
Options Builder - A builder for
DegenerateOptions, seeDegenerateOptions::builder. - Degenerate
Report - What
remove_degenerate()did. - Fill
Options - Options for
fill_holes. - Fill
Options Builder - A builder for
FillOptions, seeFillOptions::builder. - Fill
Report - What
fill_holesdid, each list in loop order. - Filled
Loop - A loop that was filled.
- LoopId
- A content fingerprint of a boundary loop, valid across edits and transactions for as long as the loop’s vertex sequence is unchanged.
- Measure
Report - Scalar measurements of a mesh, see
measure. - Offset
Options - Options for
offset. - Offset
Options Builder - A builder for
OffsetOptions, seeOffsetOptions::builder. - Offset
Report - What
offsetdid. - Orient
Report - What
orient()did. - Remove
Report - What
remove_small_components()did. - Shell
Options - Options for
shell. - Shell
Options Builder - A builder for
ShellOptions, seeShellOptions::builder. - Shell
Report - What
shelldid. - Weld
Report - What
weld()did.
Enums§
- Auto
Repair Stage - One stage’s report in an
AutoRepairReport. - Edge
Kind - How many triangles share an edge. Re-exported from
fast_mesh_store, whose corner table uses the same three kinds with the same meaning, so that callers of both crates see one type. Kind of the edge opposite a corner. - Fail
Reason - Why a selected loop could not be filled; it is left open.
- Fair
Weights - The edge weights of the Laplacian used to fair a patch.
- OpsError
- Why a repair operation could not run.
- Skip
Reason - Why a loop was left out of the fill.
- Volume
Reason - Why
MeasureReport::volumeisNone.
Functions§
- analyze
- Reports the defects of
meshwithout changing it. - auto_
repair - Repairs a mesh with the standard cleanup pipeline:
weld()→remove_degenerate()→orient()→remove_small_components()→fill_holes(), all intx, so committing it makes one undo step. - boundary_
loops - The boundary loops of
mesh, sorted by smallest vertex, then by vertex sequence (for a closed loop, the vertex after the smallest). - cut_
by_ plane - Splits the mesh of
txwithplane: the+side stays, the-side is returned as a mesh with the same origin. Triangles crossing the plane are split along it; withoptions.capboth openings are closed with flat, unfairedfill_holespatches over the cut rim. - fill_
holes - Fills boundary loops with triangle patches, chosen by size or by id.
- measure
- Measures
meshin its local units: total area always, enclosed volume when watertight. See the module docs for the tolerant volume convention. - measure_
placed - Measures
meshwith each mesh point (the origin plus a local position) mapped throughplacefirst, so with a placement the report is in world units, exact under any positive scale. Flags and the watertight verdict are placement independent and matchmeasure. - offset
- Moves every live vertex along its smooth normal by
distance. - orient
- Makes triangle winding consistent, reversing triangles by swapping their last two vertices.
- remove_
degenerate - Removes triangles with a repeated vertex id, triangles whose area is at
most
area_epsilontimes their longest edge squared, and duplicates: of triangles with the same vertex set, all but the one with the smallest id. - remove_
small_ components - Removes the connected components (triangles joined through shared edges of any kind) that are below any bound that is set, and the vertices left unused. Triangles with a repeated vertex id belong to no component and stay.
- shell
- Solidifies the mesh into a printable shell of wall
thickness. - weld
- Merges vertices at most
toleranceapart (local units).