Shape operations · 3 of 6
Overlaps
Two more operators look at where shapes overlap:
| Operator | Result | Long form |
|---|---|---|
a & b | the region covered by both (intersection) | intersection with a, b |
a ^ b | the region covered by exactly one of them (xor) | xor with a, b |
Together with + (or |) and -, these are the four boolean operations. They follow Python's precedence for &, ^ and |: | binds loosest, then ^, then &, and all three bind looser than + and -. So a | b & c means a | (b & c). When in doubt, add parentheses.
Exercise
Two disks overlap. Keep only their overlap, a lens, and name it lens. Then, on the slab layer, draw the parts of the disks that are not shared, as one shape named rest.