manifold-rust

April 20, 2026 · View on GitHub

Demo

Pure Rust port of Manifold — a geometry library for 3D boolean operations on triangle meshes.

Part of the rust-apps suite — a collection of Rust graphics and geometry libraries by Lars Brubaker.

Status: Port in progress. See PORTING_PLAN.md for current phase.

What is Manifold?

Manifold is a high-performance C++ library for 3D solid modeling. It supports:

  • Boolean operations (union, intersection, difference) on triangle meshes
  • Mesh constructors (sphere, cube, cylinder, extrude, revolve)
  • Cross-section (2D polygon) operations
  • Smooth subdivision and SDF-based mesh generation
  • Convex hull
  • Minkowski sum/difference

This Rust port targets exact numerical match with the C++ implementation — same algorithms, same floating-point results, same triangle topology.

Why

MatterHackers uses 3D mesh boolean operations extensively in production for 3D printing workflows. A pure Rust implementation avoids FFI overhead and integrates cleanly with Rust tooling including WASM compilation.

Usage

// Coming soon — library is being ported incrementally

Demo

An interactive WASM demo will be available at https://larsbrubaker.github.io/manifold-rust/ once the port reaches a usable state.

Building

cargo build
cargo test

Restore the upstream C++ reference before doing exact-match validation:

git submodule update --init --recursive

Build and compare against the C++ reference with:

./validate-reference.ps1

You can also run a narrower validation slice by phase, for example:

./validate-reference.ps1 -Phase phase8

This configures and builds cpp-reference/manifold, runs the matching C++ reference tests, and then runs the corresponding Rust tests for the selected phase.

For the WASM demo:

cd demo
bun run build:wasm
bun run dev

Architecture

The port follows the C++ module structure:

Rust moduleC++ sourceDescription
vec / linalglinalg.h, vec.hVector math, linear algebra
polygonpolygon.cpp2D polygon triangulation
implimpl.cpp, impl.hCore mesh data structure
constructorsconstructors.cppPrimitive mesh constructors
boolean3boolean3.cpp3D boolean operations
boolean_resultboolean_result.cppBoolean output assembly
csg_treecsg_tree.cppCSG tree evaluation
edge_opedge_op.cppEdge manipulation
face_opface_op.cppFace manipulation
smoothingsmoothing.cppSmooth normals and subdivision
subdivisionsubdivision.cppMesh subdivision
propertiesproperties.cppMesh properties
sdfsdf.cppSDF-based mesh generation
quickhullquickhull.cppConvex hull
minkowskiminkowski.cppMinkowski operations
cross_sectioncross_section/2D cross section

License

Apache-2.0 — matching the original Manifold library.

Credits