SkillAgentSearch skills...

Manifold

Geometry library for topological robustness

Install / Use

/learn @elalish/Manifold
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

About Manifold

codecov PyPI version npm version twitter

C++ Documentation | ManifoldCAD User Guide | JS/TS/WASM API | Algorithm Documentation | Blog Posts | Web Examples

Manifold is a geometry library dedicated to creating and operating on manifold triangle meshes. A manifold mesh is a mesh that represents a solid object, and so is very important in manufacturing, CAD, structural analysis, etc. Manifold also supports arbitrary vertex properties and enables mapping of materials for rendering use-cases. Our primary goal is reliability: guaranteed manifold output without caveats or edge cases. Our secondary goal is performance: efficient algorithms that make extensive use of parallelization, or pipelining when only a single thread is available.

Users

Here is an incomplete list of our users, whose integrations may be anywhere from in-progress to released. Please feel free to send a PR to update this list with your own project - it's quite difficult for us to keep track.

| | | | | --- | --- | --- | | OpenSCAD | Blender | IFCjs | | Nomad Sculpt | Grid.Space | badcad | | Godot Engine | OCADml | Flitter | | BRL-CAD | PolygonJS | Spherene | | Babylon.js | trimesh | Gypsum | | Valence 3D | bitbybit.dev | PythonOpenSCAD | | Conversation | AnchorSCAD | Dactyl Web Configurator | | Arcol | Bento3D | SKÅPA | | Cadova | BREP.io | Otterplans | | Bracket Engineer | Nodillo | CaDoodle CAD |

Bindings & Packages

Manifold has bindings to many other languages, some maintained in this repository, and others elsewhere. It can also be built in C++ via vcpkg.

| Language | Packager | Name | Maintenance | | --- | --- | --- | --- | | C | N/A | N/A | internal | | C++ | vcpkg | manifold | external | | TS/JS | npm | manifold-3d | internal | | Python | PyPI | manifold3d | internal | | Java | Maven | manifold3d | external | | Clojure | N/A | clj-manifold3d | external | | C# | NuGet | ManifoldNET | external | | Julia | Packages | ManifoldBindings.jl | external | | OCaml | N/A | OManifold | external | | Swift | SPM | Manifold-Swift | external |

Frontend Sandboxes

ManifoldCAD.org

If you like OpenSCAD / JSCAD, you might also like ManifoldCAD - our own solid modelling web app where you script in JS/TS. This uses our npm package, manifold-3d, built via WASM. It's not quite as fast as our raw C++, but it's hard to beat for interoperability.

Python Colab Example

If you prefer Python to JS/TS, make your own copy of the notebook. It demonstrates interop between our manifold3d PyPI library and the popular trimesh library, including showing the interactive model right in the notebook and saving 3D model output.

A metallic Menger sponge

Manifold Library

This library is fast with guaranteed manifold output. As such you need manifold meshes as input, which this library can create using constructors inspired by the OpenSCAD API, as well as a level set function for evaluating signed-distance functions (SDF) that improves significantly over Marching Cubes. You can also pass in your own mesh data, but you'll get an error status if the imported mesh isn't manifold. We provide a Merge function to fix slightly non-manifold meshes, but in general you may need one of the automated repair tools that exist mostly for 3D printing.

The most significant contribution here is a guaranteed-manifold mesh Boolean algorithm, which I believe is the first of its kind. If you know of another, please open a discussion - a mesh Boolean algorithm robust to edge cases has been an open problem for many years. Likewise, if the Boolean here ever fails you, please submit an issue! This Boolean forms the basis of a CAD kernel, as it allows simple shapes to be combined into more complex ones.

Manifold has full support for arbitrary vertex properties, and also has IDs that make it easy to keep track of materials and what surfaces belong to what input objects or faces. See our web example for a simple demonstration of combining objects with unique textures.

Also included are a novel and powerful suite of refining functions for smooth mesh interpolation. They handle smoothing both triangles and quads, as well as keeping polygonal faces flat. You can easily create sharp or small-radius edges where desired, or even drive the curvature by normal vectors.

To aid in speed, this library makes extensive use of parallelization through TBB, if enabled. Not everything is so parallelizable, for instance a polygon triangulation algorithm is included which is serial. Even if compiled with parallel backend, the code will still fall back to the serial version of the algorithms if the problem size is small. The WASM build is serial-only for now, but still fast.

Look in the samples directory for examples of how to use this library to make interesting 3D models. You may notice that some of these examples bare a certain resemblance to my OpenSCAD designs on Thingiverse, which is no accident. Much as I love OpenSCAD, my library is dramatically faster and the code is more flexible.

Dependencies

Manifold no longer has any required dependencies! However, we do have several optional dependencies, of which the first two are strongly encouraged: | Name | CMake Flag | Provides | | --- | --- | --- | | TBB |MANIFOLD_PAR=ON | Parallel acceleration | | Clipper2 | MANIFOLD_CROSS_SECTION=ON | 2D: CrossSection | | Nanobind | MANIFOLD_PYBIND=ON | Python bindings | | Emscripten | MANIFOLD_JSBIND=ON | JS bindings via WASM | | GTest | MANIFOLD_TEST=ON | Testing framework | | Assimp | ASSIMP_ENABLE=ON | Utilities in extras | | Tracy | TRACY_ENABLE=ON | Performance analysis |

3D Formats

Please avoid saving to STL files! They are lossy and inefficient - when saving a manifold mesh to STL there is no guarantee that the re-imported mesh will still be manifold, as the topology is lost. Please consider using 3MF instead, as this format was designed from the beginning for manifold meshes representing solid objects.

If you use vertex properties for things like interpolated normals or texture UV coordinates, glTF is recommended, specifically using the [EXT_mesh_manifold](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_manifol

Related Skills

View on GitHub
GitHub Stars1.9k
CategoryDevelopment
Updated5h ago
Forks198

Languages

C++

Security Score

95/100

Audited on Mar 30, 2026

No findings