offset¶
- photonforge.offset(operand, distance, round_joins=False)¶
Dilate or erode a set of polygons.
- Parameters:
operand (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]) – Polygons to be offset. All polygons are joined before the operation.
distance (float) – Amount to dilate (positive) or erode (negative).
round_joins (bool) – If set, substitute convex angles with round joins.
- Returns:
Resulting polygons.
- Return type:
list[Polygon]
Examples
>>> horizontal = pf.Rectangle(center=(0, 0), size=(11, 2)) >>> vertical = pf.Rectangle(center=(0, 0), size=(2, 11)) >>> outer_cross = pf.offset( ... [horizontal, vertical], 1, round_joins=True ... ) >>> inner_cross = pf.offset([horizontal, vertical], -0.5) >>> len(outer_cross), len(inner_cross) (1, 1)