Native Shell
Native Shell: AI-generated UI, native in your app, on every platform. Apps on iOS, Android, macOS, Windows and Linux, GPUI apps and web pages load signed, sandboxed TSX modules at run time and draw th
Pure Rust port of the Manifold 3D geometry library
Translation pending
Developer toolsRust · C#GitHub @larsbrubakerOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗3D mesh booleans in pure Rust — exact on clean geometry, robust on real-world geometry.
Two things in one library:
A pure-Rust port of Manifold (Emmett Lalish's C++ geometry kernel, v3.5.4) — union / intersection / difference on triangle meshes, plus constructors, cross-sections, convex hull, Minkowski, SDF meshing and smooth subdivision. The port follows the C++ algorithms and passes every ported C++ test, with exact expected values pinned so no output changes by accident. Where it does better than the C++ on purpose, the code says how and why.
A second, original "robust" boolean engine that the C++ library does not have. It accepts the meshes real pipelines actually contain — triangle soup, scans, Thingiverse downloads: non-manifold connectivity, self-intersections, doubled sheets, disconnected shells, internal voids, inside-out bodies. It computes on exact rational arithmetic with a mesh-arrangement formulation (Zhou, Grinspun, Zorin & Jacobson 2016), so its answers are decided by exact predicates rather than by tolerances.
NotClosed failures, and every volume disagreement above the sampling-noise floor
was arbitrated by an independent Monte-Carlo referee — in the robust engine's favour in
every case (~150 arbitrated meshes). The typical exact-engine failure on such input is
2–3× volume overcounting on self-overlapping shells.Auto gives you clean data by default. It picks the fast exact engine only when that
is provably safe (both operands manifold and free of self-intersections, a cached
~0.2 ms exact scan), and the robust engine otherwise. You do not have to know which kind
of mesh you were handed.+ - ^ operators), n-ary batch and
CSG-tree evaluationrepair_orientation() for inside-out bodies,
rebuild_solid(rule) to re-derive a solid from the winding numbers when rewinding is
not enough, has_self_intersections() as an exact self-scanparallel feature (rayon) — results stay bit-identical to the sequential
build; only determinism-preserving sites are parallelizedffi/manifold_rs.h) and C#/.NET bindings (dotnet/,
ManifoldRust on NuGet)cargo add manifold-rust
use manifold_rust::linalg::Vec3;
use manifold_rust::manifold::Manifold;
use manifold_rust::types::Error;
let cube = Manifold::cube(Vec3::new(1.0, 1.0, 1.0), true);
let sphere = Manifold::sphere(0.6, 32);
let result = cube.difference(&sphere);
assert_eq!(result.status(), Error::NoError);
println!("volume = {}", result.volume());
println!("area = {}", result.surface_area());
let mesh = result.get_mesh_gl(0); // vert_properties / tri_verts, ready for a GPU
Messy input — import as soup and let Auto choose the engine:
use manifold_rust::types::{BooleanConfig, BooleanEngine};
// Imports geometry the strict pipeline would reject as NotManifold.
let scan = Manifold::from_mesh_gl_robust(&mesh);
// Per call…
let cut = scan.difference_with_engine(&cutter, BooleanEngine::Auto);
// …or once, process-wide.
BooleanConfig::set_default_engine(BooleanEngine::Auto);
let cut = scan.difference(&cutter);
Geometry that is not even closed imports as empty with Error::NotClosed. The default
engine remains Exact, so existing code is unchanged.
Parallel execution (bit-identical results, roughly 2× on heavy boolean workloads):
[dependencies]
manifold-rust = { version = "0.19", features = ["parallel"] }
dotnet add package ManifoldRust
using ManifoldRust;
using Manifold body = Manifold.FromMesh(vertProperties, triVerts);
using Manifold hole = Manifold.FromMesh(holeVerts, holeTris);
// Check Status on every operand: a failed import is absorbed as empty geometry.
if (body.Status != ManifoldStatus.NoError || hole.Status != ManifoldStatus.NoError)
throw new InvalidOperationException("bad input mesh");
Manifold.DefaultBooleanEngine = BooleanEngine.Auto; // robust when it matters
using Manifold result = Manifold.BatchBoolean(new[] { body, hole }, ManifoldOpType.Subtract);
MeshGL mesh = result.GetMeshGL();
There is a double-precision path (FromMesh64 / GetMeshGL64), a robust import
(FromMeshRobust), and CancellationToken support. Full binding documentation:
dotnet/README.md; the ABI itself is described in
ffi/manifold_rs.h.
The ManifoldRust package above is a P/Invoke binding: it loads this Rust cdylib and calls
into it. manifold-sharp is the other
thing you might want — a complete pure C# port of manifold-rust, with no native library
at all, so it runs anywhere .NET runs, browser-wasm included. It is bit-exact with this
crate on identical inputs, and it lives as a submodule of
agg-sharp.
The two projects check each other: manifold-sharp's oracle test lane runs the same operations through its port and through this library via the binding, then compares the exported meshes row for row with no slack.
#[ignore]d tests are slow
ones that pass in release, measurement fixtures run on demand, and an open bug pinned
until its fix lands. Open work is in PORTING_PLAN.md.parallel
feature roughly doubles throughput. Reproduce with
cargo run --release --example perf_test and --example large_scene_test.src/robust/mod.rs's header says how
it is verified; examples/thingi_sweep.rs and examples/volume_referee.rs are the
sweep and the referee, and its open items are in PORTING_PLAN.md.Known limits, honestly:
Cancelled rather than wrong. Speeding up the exact-predicate fallback is the top
open item.parallel feature is native-only.Error::NotClosed.cargo build
cargo test --release
Run the upstream C++ tests next to the matching Rust tests (needs the submodule):
git submodule update --init --recursive
./validate-reference.ps1 # or: ./validate-reference.ps1 -Phase phase8
The WASM demo:
cd demo && bun run build:wasm && bun run dev
manifold-rust is open source, free to use, and maintained in spare time as a labor of love (friends James Smith and Dan Ruskin help out from time to time). MatterHackers sponsors the work — it uses mesh booleans extensively in production 3D-printing workflows, which is why a dependable pure-Rust kernel exists at all.
Part of the rust-apps suite — Rust graphics and geometry libraries by Lars Brubaker.
Apache-2.0, matching the original Manifold library.