Boolean operators

Boolean operators

Weak to strong: | (OR), ^ (XOR), & (AND), - (difference). + is the same as |. The result is always polygons, even if an operand was edges (those are turned into polygons first). An empty operand: AND/OR/XOR with empty is empty; A - empty is A; empty - A is empty. a & b connected / not_connected keeps only result pieces whose A-shape and B-shape sit on the same (connected) or a different (not_connected) geometric net of a|b (touch/overlap = one net).

← Language overview

a | b

Available · yields polygons

layer u = a | b

Geometric union (OR). Overlap becomes one area. Alias a + b.

Input Result

Also written as: a + b

Notes

  • Only a shared edge (no area): the union joins when the boolean engine splits that edge; a kiss at a single point is stitched by a later merged.
  • A hole in A that B fills disappears.
  • More than two layers: (a | b) | c. Chains of | associate to the left.

a & b

Available · yields polygons

layer i = a & b

Intersection (AND). Only area that lies in A and B.

Input Result

Notes

  • Kissing without area overlap (edge to edge, area 0): empty (area ≤ 0.5 dbu² does not count as overlap; AND may drop a degenerate sliver).
  • A completely inside B: result = A (after boolean clean-up).
  • Holes: intersecting a ring can inherit the hole or cut it open.

a - b

Available · yields polygons

layer d = a - b

Difference: A without B. Can split A into several polygons or into a polygon with a hole.

Input Result

Notes

  • B covers A completely: empty.
  • B lies completely in A and does not touch the outline: A with a hole.
  • B only on the edge of A: often unchanged A (no area subtracted).

a ^ b

Available · yields polygons

layer x = a ^ b

XOR: area in exactly one of the two layers. Equivalent to (a - b) | (b - a).

Input Result

Notes

  • Identical geometry: empty.
  • Only the overlap region disappears; the two crescents stay separate polygons until a later merged.