intersects¶
- photonforge.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.
- Parameters:
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:
Whether any polygon in
operand1intersects any polygon inoperand2.- Return type:
bool
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