Surface booleans (mesh_boolean)
meshioplusplus.mesh_boolean(a, b, op) computes the union, difference or intersection of two closed, oriented triangle surfaces (roadmap 9.1). The boolean itself is a provider's: meshio++ hands the two triangle soups to the registered BooleanProvider and returns its surface. The provider shipped is Manifold (Apache-2.0), whose results are guaranteed manifold.
import meshioplusplus as mp
a = mp.icosa_sphere(subdivisions=3)
b = mp.icosa_sphere(subdivisions=3, center=(0.5, 0.0, 0.0))
union, report = mp.mesh_boolean(a, b, "union", return_report=True)
print(report) # {'backend': 'manifold', 'num_triangles': ...}Getting a provider
- a source build with
-DMESHIOPLUSPLUS_WITH_MANIFOLD=ON -DMANIFOLD_ROOT=<prefix>(build/configure.sh --with-manifold --manifold-root <prefix>), wherebuild/build-manifold.sh <prefix>builds the pinned Manifold (build/deps-pins.sh) without TBB or bindings; - the
meshioplusplus-manifoldadd-on wheel (pip install "meshioplusplus[manifold]"), which registers the provider with the base wheel's core on import; - any program that calls
register_boolean_provider(C++) or loads a plugin that does.
has_boolean_provider() says whether one is registered; without one mesh_boolean raises naming the build option. The default WebAssembly artifact has none.
Inputs and output
Both inputs must be closed, consistently oriented triangle surfaces; quads and polygons are fanned first, and a surface the provider rejects (open, self-intersecting) raises with its reason. The result is one triangle block with no data: the operation builds new geometry, so point and cell data, regions and field data are not carried. backend names a provider to insist on; empty takes the registered one.
Measured
The synthetic corpus of the earlier surface-boolean spike (tools/boolean_corpus.py synthetic, seed 78; overlapping spheres, sphere–box and rotated boxes, crossing tori, torus–sphere and eight fixed degenerate contacts) runs through Manifold with --backend provider; the numbers are in spikes. CI's providers job reruns 40 seeded cases on every pull request, and boolean_corpus.yml runs the Thingi10K sample weekly.
Surfaces
C++ operations/mesh_boolean.hpp; Python mesh_boolean, has_boolean_provider; C mio_mesh_boolean, mio_has_boolean_provider; Fortran mio_mesh_boolean; Julia mesh_boolean; R mio_mesh_boolean; Octave/MATLAB mio.mesh_boolean; WASM meshBoolean, hasBooleanProvider; both CLIs mesh-boolean A B OUTFILE --op; the version-2 pipeline step MeshBoolean (Inputs, Operation, Backend); the MCP tool mesh_boolean.