Problemcore
Boolean operations on solids
Also called solid Booleans, solid set operations.
Given two solids as boundary representations, compute the B-rep of their regularized union, intersection or difference.
The Boolean operation problem on solids asks for the boundary of the union, intersection or difference of two solids, given by their boundaries. The operations are the regularized ones of regularized set operations, so the result is again a solid, with no dangling faces or edges. It is the core operation of a B-rep modeler: drilling a hole is a difference, and adding a boss is a union. The output can have size proportional to the product of the input sizes, and arbitrarily small changes of the input can change the topology of the output, which is why the problem is hard to solve robustly in floating point.
In plain words
You have two solid objects stored by their skins: the faces, edges and corners on the outside. You want the skin of a new object: everything in either one, the part they share, or the first one with the second one cut out.
The new skin is made of pieces of the old skins. The task is to find where the two skins cross, cut them there, keep the right pieces, and join the pieces into a closed skin.
Two things make this harder than it sounds. When two objects touch along a face or an edge, the rules must say exactly what happens to the shared part. And a computer that rounds its numbers can decide that a corner is on both sides of a face at once.
Definition
Input. Two solids and in , each an r-set (a bounded, closed, regular and semianalytic set), given as a valid boundary representation: faces with an outward orientation, their bounding loops of edges, and the vertices, with the adjacency between them. An operation .
Output. A valid B-rep of the solid , where , and . Valid means that the faces cover , that they meet only along edges and vertices, that each face is oriented with on its inner side, and that the face, edge and vertex records agree with each other. can be empty.
Constraints. The output describes the exact set . Two coplanar neighboring faces may be merged into one face or left as two faces; both are valid, but the merged form is the canonical one. The input can be degenerate: faces can be coplanar, solids can touch along faces, edges or vertices, and a vertex of one solid can lie on a face of the other. These cases are part of the problem, not an exception to it.
Size. Let and be the total number of vertices, edges and faces of and . The output size is measured in the same way.
Model. The real RAM with exact signs for the upper bounds. The polyhedral case is the base case. For curved faces the input also includes the surfaces, and the edges of include the intersection curves of surface surface intersection.
Variants
- CSG input. The input is a CSG tree of primitives, and the output is the B-rep of the whole tree. This is the conversion problem solved by boundary evaluation. A Boolean of two B-reps is the case of a tree with one inner node and two leaves.
- Plain set operations. Without regularization, the intersection of two cubes that share a face is that face, and the result is not a solid. Some systems keep these lower-dimensional parts on purpose, which needs a non-manifold data structure such as the radial edge structure.
- Manifold output. The regularized union of two manifold solids can be non-manifold, for example two cubes that share one edge. A system that stores only manifold solids must reject such a result or split it.
- Convex polyhedra. The intersection of two convex polyhedra is a convex polyhedron of size . The union and the difference of convex polyhedra are not convex.
- Many operands. The union of solids at once, which avoids building the intermediate results.
- Meshes. The input is a triangle mesh that can be open or self-intersecting, and the inside is defined by a winding number. See mesh Boolean operations.
- The plane. Booleans on polygons, the problem of polygon clipping.
Examples
All results below are regularized and can be checked by hand. For each B-rep the counts , , of vertices, edges and faces obey the Euler-Poincaré formula, here for shells without holes or handles.
Two overlapping cubes. and , each with volume .
| result | volume | faces | |||
|---|---|---|---|---|---|
| 6 squares and 6 L-shaped hexagons | |||||
| the cube | |||||
| 3 squares of side 2, 3 L-shaped hexagons, 3 unit squares |
The union has the 7 corners of outside , the 7 corners of outside , and 6 new vertices where an edge of one cube passes through a face of the other, such as . The difference has the 7 corners of , the same 6 new vertices, and the corner of , which is the inner corner of the notch.
Two touching cubes. and share the face . The union is the box with volume and, after merging, faces; the shared face is not on its boundary. The intersection is empty, although the plain intersection is the square . The difference is .
Two cubes that share an edge. and meet along the segment . The union is a solid with volume whose boundary is not a 2-manifold along that segment, where four faces meet.
A cavity. and . Then has volume and two shells, the outer cube and the inner cube with its faces turned inward. , , , and .
Known algorithms
- Boundary evaluation (Requicha and Voelcker). Cut each face of each solid by the other solid, classify each piece as on the boundary of the result or not, and keep the boundary pieces with the right orientation. It handles CSG trees and the degenerate cases by its side rules. The page proves it correct and gives time for convex primitives with face planes in all, which is far from tight for real models.
- Vertex neighborhood classification (Mäntylä). Generate the crossing points of the two boundaries, classify the neighborhood of each vertex of the crossing, and connect the kept edges into faces. It works on two B-reps and makes each in, out or on decision from one vertex neighborhood, which handles coincident faces and edges locally. The page gives time for the planar version with edges.
- Set membership classification (Tilove). The classification of a point, segment or face against a solid as in, out or on. It is the classify step of both methods above, and its correctness gives their correctness.
- Convex polyhedra. Chazelle computes for two convex polyhedra in time, which is optimal.
- Mesh methods. Mesh arrangements build the full arrangement of the two triangle meshes, label each cell with winding numbers, and extract the boundary of the cells that the operation selects.
- Robust floating point. Hoffmann, Hopcroft and Karasick give a polyhedral Boolean in floating point that derives each uncertain decision from the decisions it has already made, so that the result is consistent. Exact arithmetic is the other route; see exact geometric computation.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Boundary evaluation | O(m^4) worst | O(m^3) extra | deterministicofflineiterative | 1 language |
| Vertex neighborhood classification | O(n^2 log n) worst | O(n^2) extra | deterministicofflineiterative | 1 language |
Bounds
Output size. The output can have size, and no more. Upper bound. Each vertex of is a vertex of or , or the meeting point of an edge of one solid with a face of the other, or, in degenerate input, the meeting point of two edges. A segment that is not in a plane meets the plane in at most one point, so there are vertices. Each face of lies in one face of or , and the pieces of each input face form a planar graph, so the edges and faces are also . Lower bound. Let be a comb: the base with teeth . It has faces. Let be the same comb turned by a right angle and hung from above: the base with teeth . Then is the disjoint unit cubes , with faces, since the contacts at and have no volume. So every algorithm that writes the output takes time in the worst case.
Convex case. The intersection of two convex polyhedra has size, and the bound of Chazelle is optimal.
Discontinuity. The output is not a continuous function of the input. Move in the touching example by along . For every the union has two shells, and for it is one box. For every the intersection is a thin box with faces, and for it is empty. Any arbitrarily small rounding error at such an input can change the combinatorial answer, and CAD models contain such inputs on purpose. This is the geometric robustness problem in its sharpest form.
The bounds above are proved. The running times of practical Boolean codes, which use bounding boxes and spatial indexes to skip most pairs of faces, are measured, not proved.
Reductions
- From polygon Booleans. For polygons and , , with the regularized operations on both sides. So a solid Boolean solves polygon clipping with a constant factor more work.
- To CSG boundary evaluation and back. A CSG tree is evaluated by one Boolean for each inner node, from the leaves up. A Boolean of two B-reps is the evaluation of a tree with one inner node.
- Interference detection. Two parts of an assembly collide exactly when . This decision problem reduces to the Boolean, but it is easier, since it needs only one witness point.
- Mass properties of a combination. The volume of is a mass property of the Boolean result.
Applications
- Feature modeling. Holes, pockets, slots and fillets of a mechanical part are differences and unions with simple tool solids.
- Machining simulation. The stock after a cut is the stock minus the volume swept by the tool.
- Assembly checks. The interference of two parts is their intersection.
- 3D printing and meshes. The union of the parts of a model gives one printable surface.
- Conversion. Boundary evaluation turns CSG models into B-reps for display, meshing and analysis.
References
- Aristides A. G. Requicha and Herbert B. Voelcker, Boolean operations in solid modeling, boundary evaluation and merging algorithms, Proceedings of the IEEE 73(1), 30 to 44, 1985, the whole paper (the statement of the problem for B-reps and CSG trees, and the generate, classify and merge scheme)
- Aristides A. G. Requicha, Representations for rigid solids, theory, methods, and systems, ACM Computing Surveys 12(4), 437 to 464, 1980, the definition of solids as r-sets, the regularized operations, and the conversion between representations
- Martti Mäntylä, Boolean operations of 2-manifolds through vertex neighborhood classification, ACM Transactions on Graphics 5(1), 1 to 29, 1986, the whole paper (Booleans on B-reps of manifold solids, with the degenerate cases of coincident faces, edges and vertices)
- Christoph M. Hoffmann, John E. Hopcroft and Michael S. Karasick, Robust set operations on polyhedral solids, IEEE Computer Graphics and Applications 9(6), 50 to 59, 1989, the whole paper (Booleans on polyhedra in floating point with consistent decisions)
- Christoph M. Hoffmann, Geometric and Solid Modeling, An Introduction, Morgan Kaufmann, 1989, Chapter 3, Boolean operations on boundary representations
- Bernard Chazelle, An optimal algorithm for intersecting three-dimensional convex polyhedra, SIAM Journal on Computing 21(4), 671 to 696, 1992, the whole paper (the intersection of two convex polyhedra in linear time)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag QS04RA Edit this page History Report an error Markdown