MeshRepair

Trait MeshRepair 

Source
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§

Source

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:

  1. Vertex stitching (merge nearby vertices)
  2. Remove degenerate/duplicate triangles
  3. Remove unused vertices
  4. Remove disconnected islands (keep largest component)
  5. Fill holes (simple fan triangulation)
  6. 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.)

Implementors§