Expand description
Shell generation around 3D meshes using SDF-based offset.
This crate provides tools for generating printable shells around 3D meshes using signed distance field (SDF) based offset techniques.
§Features
- SDF-based offset: Robust offset that avoids self-intersections
- Variable offset: Per-vertex offset values for complex shapes
- Shell generation: Create watertight shells with walls
- Rim generation: Clean boundary edges connecting inner and outer surfaces
§Example
use mesh_repair::Mesh;
use mesh_shell::{apply_sdf_offset, generate_shell, SdfOffsetParams, ShellParams};
// Load and prepare mesh
let mut mesh = Mesh::load("scan.stl").unwrap();
// Set offset values on vertices (uses mesh.vertices[i].offset field)
for v in &mut mesh.vertices {
v.offset = Some(2.0); // 2mm outward offset
}
// Apply SDF offset to create the inner shell
let params = SdfOffsetParams::default();
let result = apply_sdf_offset(&mesh, ¶ms).unwrap();
let inner_shell = result.mesh;
// Generate printable shell with walls
let shell_params = ShellParams::default();
let (shell, stats) = generate_shell(&inner_shell, &shell_params);
shell.save("shell.3mf").unwrap();Structs§
- SdfOffset
Params - Parameters for SDF offset operation.
- SdfOffset
Result - Result of SDF offset operation.
- SdfOffset
Stats - Statistics from SDF offset operation.
- Shell
Generation Result - Result of shell generation.
- Shell
Params - Parameters for shell generation.
Enums§
- Shell
Error - Errors that can occur during shell operations.
Functions§
- apply_
sdf_ offset - Apply SDF-based offset to create a new mesh with variable offsets.
- generate_
shell - Generate a printable shell from the inner surface.
Type Aliases§
- Shell
Result - Result type alias for shell operations.