3 releases

Uses new Rust 2024

new 0.4.3 Apr 11, 2026
0.4.1 Sep 8, 2025
0.4.0 Sep 7, 2025

#1677 in Algorithms

Download history 50/week @ 2025-12-17 38/week @ 2025-12-31 2/week @ 2026-01-07 36/week @ 2026-01-14 189/week @ 2026-01-21 131/week @ 2026-01-28 19/week @ 2026-02-04 69/week @ 2026-02-11 234/week @ 2026-02-18 265/week @ 2026-02-25 175/week @ 2026-03-04 17/week @ 2026-03-11 50/week @ 2026-03-18 37/week @ 2026-03-25 24/week @ 2026-04-01

140 downloads per month
Used in fidget

MPL-2.0 license

565KB
13K SLoC

Octree construction and meshing

This module implements Manifold Dual Contouring, to generate a triangle mesh from an implicit surface (or anything implementing Shape).

The resulting meshes should be

  • Manifold
  • Watertight
  • Preserving sharp features (corners / edges)

However, they may contain self-intersections, and are not guaranteed to catch thin features (below the sampling grid resolution).

The resulting Mesh objects can be written out as STL files.

Here's a full example, meshing a sphere:

use fidget_core::{
    context::Tree,
    vm::VmShape
};
use fidget_mesh::{Octree, Settings};

let radius_squared = Tree::x().square()
    + Tree::y().square()
    + Tree::z().square();
let tree: Tree = radius_squared.sqrt() - 0.6;
let shape = VmShape::from(tree);
let settings = Settings {
    depth: 4,
    ..Default::default()
};
let o = Octree::build(&shape, &settings).unwrap();
let mesh = o.walk_dual();

// Open a file to write, e.g.
// let mut f = std::fs::File::create("out.stl")?;
mesh.write_stl(&mut f)?;

fidget-mesh implements meshing of complex closed-form implicit surfaces.

It is typically used through the fidget crate, which imports it under the mesh namespace

» Crate » Docs » CI » MPL-2.0

Dependencies

~11–15MB
~273K SLoC