boolean
boolean(operand1, operand2, operation)Compute the boolean operation between 2 sets of polygons.
Args
- operand1 (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]): First operand for the boolean operation. All polygons defined in
operand1are joined before the operation. - operand2 (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]): Second operand for the boolean operation. All polygons defined in
operand2are joined before the operation. - operation (Literal[”+”, "", ”-”, ”^”]): One of ”+” (union), "" (intersection), ”-” (difference), or ”^” (symmetric difference).
Returns
list[Polygon]: Resulting polygons.
Examples
>>> horizontal = pf.Rectangle(center=(0, 0), size=(11, 2))>>> vertical = pf.Rectangle(center=(0, 0), size=(2, 11))>>> donut = pf.Circle(5, inner_radius=3)>>> union = pf.boolean(donut, [horizontal, vertical], "+")>>> len(union)1>>> difference = pf.boolean(donut, [horizontal, vertical], "-")>>> len(difference)4