mesh-shell 0.1.0

Generate shells around 3D meshes using SDF-based offset
Documentation

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();