intersects
intersects(operand1, operand2)Check whether 2 sets of polygons share any point.
Overlapping area, a shared stretch of edge, and a single shared vertex all count. A hole is a void, so a polygon nested in a hole of the other does not intersect it. The test runs on the integer database grid, without floating-point conversions.
Args
- operand1 (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]): First set of polygons.
- operand2 (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]): Second set of polygons.
Returns
bool: Whether any polygon in operand1 intersects any polygon in
operand2.
Examples
>>> square = pf.Rectangle(center=(0, 0), size=(2, 2))>>> pf.intersects(square, pf.Rectangle(center=(2, 0), size=(2, 2)))True>>> pf.intersects(square, pf.Rectangle(center=(3, 0), size=(2, 2)))False