--- jupyter: description: 'Exact Boolean operations in planex2d: union, difference and intersection of faces, many faces at once on all cores, gluing regions for meshing, uniting wires, and splitting and trimming along any curve.' --- # Booleans - [Two faces](two-faces.md) - [Many faces at once](many-faces.md) - [Faces and wires](faces-and-wires.md) - [Splitting and trimming](split-trim.md) - [Traces and pads](traces.md)
A rack cutter rolling over a gear blank and cutting its teeth, one subtraction per cutter positionExample A gear cut by its rack: one subtraction per position A Voronoi bone scaffold of some 6000 struts unitedExample A bone scaffold: some 6000 struts united A motor lamination glued into stator, coils, rotor and magnetsExample A motor lamination glued into its regions A sofa carried around the corner of a hallway, found as the intersection of the hallway in every positionExample The moving sofa as one intersection
Faces combine with `+` (union), `-` (difference) and `*` (intersection), and lists of faces with `px.Unify`, `px.Subtract` and `px.Intersect`, which run on all cores. Every edge is cut where it meets an edge of the other operand. After that, each piece lies wholly inside, wholly outside or on the boundary of the other operand, so one test at its midpoint decides whether it stays. Where edges meet, they share one bit-exact vertex, so no gap remains between them, and the areas agree with their formulas up to rounding. Lines, arcs and full circles stay exact, and the result is a shape of clean faces, ready for the next operation. `px.Glue` keeps the parts as regions that share their common edges, which is what a mesher needs for several materials. See [Faces, shapes and compounds](../basics/faces-shapes-compounds.md) for gluing faces. `Split` and `Trim` cut faces and wires along any curve.

In this section

Two faces
Two facesUnion, difference and intersection of two faces, keeping names and colors.
Many faces at once
Many faces at onceUnify, Subtract and Intersect on lists, as a balanced tree on all cores.
Faces and wires
Faces and wiresWires united and glued, as in a truss built from its member center lines.
Splitting and trimming
Splitting and trimmingA face cut along any curve, from segments to trimmed blanks and punched holes.
Traces and pads
Traces and padsOffsets of paths, round pads and drills, with every edge named after its net.
## Everything at a glance | | | |---|---| | **Two faces** | `a + b`, `a - b`, `a * b`, `a += b`, `a -= b`, `a *= b` | | **Many faces** | `px.Unify(faces)`, `px.Intersect(faces)`, `px.Subtract([first, *others])`, on all cores | | **Wires** | `wire + wire` unites wires; `face + wire` raises a `TypeError`. | | **Glue** | `px.Glue(parts)` cuts faces and wires against each other. Faces that touch share their edges. Two overlapping parts give three faces, each part alone and the overlap, which takes the first part's properties. A part entirely inside another keeps its own region and properties, and a wire through a face splits it. | | **Splitting** | `Split(cutter)`, `Trim(cutter, keep_closest_to=, remove_closest_to=, keep_largest=, keep_smallest=, keep_left=, keep_right=)` |