repair_shell

Function repair_shell 

Source
pub fn repair_shell(shell: &mut Mesh) -> ShellRepairResult
Expand description

Attempt to automatically repair minor issues in a shell mesh.

This function can fix:

  • Inconsistent winding order (using flood-fill algorithm)
  • Degenerate triangles (removes them)

It cannot fix:

  • Non-watertight meshes (holes) - would require hole-filling which may not be appropriate for all shell geometries
  • Non-manifold edges - requires manual intervention

§Arguments

  • shell - The shell mesh to repair (modified in place)

§Returns

A ShellRepairResult with details about repairs performed.

§Example

use mesh_repair::Mesh;
use mesh_shell::{validate_shell, repair_shell};

let mut shell = Mesh::new();
// ... generate shell ...
let repair_result = repair_shell(&mut shell);
if repair_result.success {
    println!("{}", repair_result);
}
let validation = validate_shell(&shell);