pub trait MeshRepair {
// Required method
fn repair(&mut self, options: RepairOptions) -> RepairStats;
}Expand description
Trait for mesh repair operations.
Provides automatic mesh repair functionality to fix common geometry issues such as duplicate vertices, degenerate triangles, inconsistent orientation, holes, and disconnected components.
§Examples
use lib3mf_core::model::{Mesh, repair::{MeshRepair, RepairOptions}};
let mut mesh = Mesh::new();
// ... add geometry ...
let options = RepairOptions::default();
let stats = mesh.repair(options);
println!("Removed {} degenerate triangles", stats.triangles_removed);Required Methods§
Sourcefn repair(&mut self, options: RepairOptions) -> RepairStats
fn repair(&mut self, options: RepairOptions) -> RepairStats
Attempts to repair the mesh in-place based on the provided options.
Applies the requested repair operations in order:
- Vertex stitching (merge nearby vertices)
- Remove degenerate/duplicate triangles
- Remove unused vertices
- Remove disconnected islands (keep largest component)
- Fill holes (simple fan triangulation)
- Harmonize orientation (consistent winding)
§Arguments
options- Configuration for which repairs to apply and their parameters
§Returns
Statistics about what repairs were performed (vertices/triangles removed, etc.)