---
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)
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
## 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=)` |