Crate mesh_shell

Crate mesh_shell 

Source
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, &params).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§

SdfOffsetParams
Parameters for SDF offset operation.
SdfOffsetResult
Result of SDF offset operation.
SdfOffsetStats
Statistics from SDF offset operation.
ShellGenerationResult
Result of shell generation.
ShellParams
Parameters for shell generation.

Enums§

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

ShellResult
Result type alias for shell operations.