- Published: 2025-06-25
- Updated: 2025-06-25
- MeshLib Team
3D Mesh Intersection
Mesh intersection computes the exact common volume shared by two polygonal models. Its potential, is applied to 3D data processing, computational geometry, and computer graphics. Namely, it enables precise extraction of overlapping geometries. That is how it ensures that only the regions where meshes occupy the same space are retained.
Please note: when referring to mesh intersection, one might mean either a subtype of Boolean operations (as in this case) or mesh collision detection. If you are interested in the Boolean meaning, this section is for you. If you are looking for collision detection, here is another guide for you.
Mesh intersection is fundamental for combining complex shapes and refining models across a variety of domains. To name a few:
- In CAD and engineering, Mesh intersection verifies how components fit together by isolating mating surfaces.
- As for additive manufacturing and 3D printing, mesh intersection operations check for hidden overlaps between parts in a build tray to prevent fused prints or weak joints.
- Regarding scientific visualization and simulation, mesh intersection identifies intersecting volumes for structure interactions or medical imaging analyses.
All in all, by focusing computation only on shared volumes, this manipulation enhances both accuracy and performance across modeling and design.
Mesh Intersection Algorithms
Given the importance of mesh intersection, it is no surprise that there exist multiple approaches and mesh intersection algorithms. These ones come to mind first:
- Exact-Arithmetic & B-Rep. Building a precise boundary representation via rational arithmetic or robust predicates. Then face–face slicing via CSG (constructive solid geometry) is performed:
- Strengths. Watertight results are guaranteed. Degeneracies are handled without failures.
- Cons. Higher memory footprint is inevitable. It is a slower and more complex option to implement for intersecting meshes.
- Floating-Point and Tolerance-Based CSG. Employing floating-point arithmetic with user-tunable epsilon thresholds to clip one object by the planes of another and classify fragments.
- Strengths. In general, it is faster and simpler than the previous one. As such, it is well-suited regarding most objects.
- Cons. It can produce cracks, slivers, or non-manifold edges if tolerances are not tuned carefully.
- BSP-Tree CSG. Recursively subdividing space with splitting planes and classifying entire model fragments as inside or outside before reassembling the intersected region.
- Strengths. Very fast when it comes to complex and static scenes, as well as multi-mesh combinations.
- Cons. Here, trees can become unbalanced. Also, memory and storage overhead for fragment data can be high.
- Voxel and Grid-Based Methods. Rasterizing each object into a 3D occupancy grid, computing the Boolean on the grid cells, then extracting the intersected surface with an iso-surfacing algorithm.
- Strengths. It is intrinsically robust to degeneracies. On top of that, it is trivially parallelizable.
- Cons. Surface fidelity suffers unless using very fine grids, which greatly increases memory use.
Finally, let’s discuss what fuels our engine. As far as MeshLib is involved, our capability to find intersections between meshes for computer graphics and similar tasks is based on the Simulation of Simplicity (SoS) paradigm. Rather than handling every degeneracy explicitly, SoS treats input geometry as if it were in ‘general position.’ No two vertices coincide exactly, no edges overlap, and no zero-length distances exist.
Internally, every comparison and intersection test uses symbolic perturbations to break ties and avoid special-case logic. As a result, we behave as though no degenerate cases can occur.
Hence, MeshLib’s toolbox delivers:
- Solid robustness. We do not crash or yield invalid topology on messy models.
- Consistent performance. Inner loops remain branch-light and highly optimized.
- Straightforward implementation. The core routines assume only generic inputs.
Mesh to Mesh Intersection
It is a moment to take a step back for a second. Again, the mesh intersection formula looks as follows:
The operation itself generates a new mesh representing exactly the volume (or surface) shared by two input geometries, i.e., the contact zone where meshes intersect.
This intersected object can be used as a standalone object. Alternatively, the output can be incorporated into more complex workflows.
In practical terms, the following functions are employed for mesh intersection operations:
- cutMesh. Cuts the input object along the supplied contours. This creates new edge loops and fragments the model to prepare matching boundaries for Boolean operations (in this case, intersection).
- boolean. Executes the specified Boolean operation (e.g. intersection) on two meshes, clipping, classifying, and stitching fragments into the final intersected mesh.
3D Mesh Intersection in C++ and Python: Code Examples
import meshlib.mrmeshpy as mrmeshpy
# create first sphere with radius of 1 unit
sphere1 = mrmeshpy.makeUVSphere(1.0, 64, 64)
# create second sphere by cloning the first sphere and moving it in X direction
sphere2 = mrmeshpy.copyMesh(sphere1)
xf = mrmeshpy.AffineXf3f.translation(mrmeshpy.Vector3f(0.7, 0.0, 0.0))
sphere2.transform(xf)
# perform Intersection operation
result = mrmeshpy.boolean(sphere1, sphere2, mrmeshpy.BooleanOperation.Intersection)
if not result.valid():
print(result.errorString)
else:
# save result to STL file
mrmeshpy.saveMesh(result.mesh, "out_boolean.stl")
#include
#include
#include
#include
#include
int main()
{
// create first sphere with radius of 1 unit
MR::Mesh sphere1 = MR::makeUVSphere( 1.0f, 64, 64 );
// create second sphere by cloning the first sphere and moving it in X direction
MR::Mesh sphere2 = sphere1;
MR::AffineXf3f xf = MR::AffineXf3f::translation( MR::Vector3f( 0.7f, 0.0f, 0.0f ) );
sphere2.transform( xf );
// perform Intersection operation
MR::BooleanResult result = MR::boolean( sphere1, sphere2, MR::BooleanOperation::Intersection );
MR::Mesh resultMesh = *result;
if ( !result.valid() )
std::cerr << result.errorString << std::endl;
// save result to STL file
MR::MeshSave::toAnySupportedFormat( resultMesh, "out_boolean.stl" );
return 0;
}


Mesh Intersection with MeshLib: Executed Step by Step With The Single Boolean Function
In one’s actual practice, the sequence of steps—all taken via our single Boolean function, will look like:
- Preparing input meshes, i.e., loading or creating the two meshes you wish to intersect.
- Aligning Mesh B to Mesh A’s space. That is, applying a rigid transform so that both meshes share a common coordinate frame.
- Using our functions to swiftly retrieve the raw intersection vertices and edges for inspection.
- Generating cut contours.
- Cutting each object along contours and invoking the result with the prepared contours to split both meshes along matching edge loops.
- Executing the intersection. Calling the boolean function with the two cut meshes and to perform clipping, fragment classification, and stitching into the final intersected mesh.
- Retrieving and validating the result.
Daily, countless teams all over the world apply MeshLib, across:
- Engineering to detect and quantify interferences or mating surfaces between mechanical parts during design reviews.
- Physics engines to generate precise collision meshes and contact volumes.
- Simulation and analysis to identify and obtain overlapping regions when assessing various structure interactions.
- Rendering to create complex cut-away views, dynamic clipping effects, or Boolean-based scene composition.
- 3D printing and manufacturing to trim models to build-plate boundaries, merge assemblies at overlapping interfaces, or generate supports only where meshes intersect.
- Medical imaging to locate common volumes between anatomical scans for volume measurement and surgical planning.
MeshLib Library for 3D Mesh Intersection
As a 3D processing library, MeshLib excels when it comes to mesh intersection. To substantiate this claim, we highlight how we compare with other 3D processing altern
Mesh Intersection Case # 1. Nefertiti Mesh
In this benchmark, two 3D models, each containing roughly two million triangles and intricate topological details, are used.

Case | MeshLib 2.4.0.85 | MCut | Manifold | CinoLib + RobustMesh | CGAL | Rhino 3D | Libigl | Trimesh-Manifold | Trimesh-Blender |
---|---|---|---|---|---|---|---|---|---|
Nefertiti – Intersection | 0.7 (0.9) | 46 | 1.0 (2.5) | 8.1 | 6.7 | 54 | 43.6 | 2.9 | 36 |
Notes:
- All results are in seconds.
- Red numbers indicate the operation ran but produced an incorrect result.
- The number in parentheses adds the one-time geometric setup to the per-call time. For example, 0.7 (0.9) means each subsequent call takes 0.7 s, while the first call takes 0.9 s (0.7 s + 0.2 s one-off preparation).
Mesh Intersection Case #2. Dental Mesh
Here, two dental models (around 500 K triangles in each) with degeneracies and coinciding surfaces. This test reflects real-world medical scenarios. Same notes apply.

Case | MeshLib 2.4.0.85 | MCut | Manifold | CinoLib + RobustMesh | CGAL | Rhino 3D | Libigl | Trimesh-Manifold | Trimesh-Blender |
---|---|---|---|---|---|---|---|---|---|
Dental Intersection | 0.17 (0.20) | Fail | 0.21 (0.52) | 0.7 | 1.6 | 15 | 5.1 | 0.5 | 4.5 |
Guide to Boolean operations with MeshLib: including mesh intersection, over union and difference. Github link
MeshLib’s collision-detection core is implemented in tuned C++ for maximum throughput, with fully functional bindings for C, C#, and Python. So one is free to it integrate it into virtually any up-to-date stack.
C++ (native):
Follow the C++ Setup Guide for installation.
Python:
See the Python Setup Guide. MeshLib supports Python 3.8–3.13 on Windows, Linux distributions that provide manylinux_2_31 wheels, and macOS—except that Python 3.8 on x64 macOS is not supported.
What our customers say
Thomas Tong
Founder, Polyga

Gal Cohen
CTO, customed.ai

Mariusz Hermansdorfer
Head of Computational Design at Henning Larsen Architechts

HeonJae Cho, DDS, MSD, PhD
Chief Executive Officer, 3DONS INC

Ruedger Rubbert
Chief Technology Officer, Brius Technologies Inc








Start Your Journey with MeshLib
MeshLib SDK offers multiple ways to dive in — from live technical demos to full application trials and hands-on SDK access. No complicated setups or hidden steps. Just the tools you need to start building smarter, faster, and better.
