Skip to content

boolean

boolean(operand1, operand2, operation)

Compute the boolean operation between 2 sets of polygons.

Args

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