heal¶
- photonforge.heal(operand, feature_size)¶
Heal a set of polygons by removing small features.
Healing uses an opening and closing sequence of morphological operations to eliminate small features from the polygon set.
- Parameters:
operand (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]) – Polygons to be healed. All polygons are joined before the operation.
feature_size (float) – Minimal desired feature size. This value can be negative to reverse the order of operations, performing the closing operation before the opening. See note below.
- Returns:
Resulting polygons.
- Return type:
list[Polygon]
Note
The implementation is equivalent to:
eroded = offset(operand, -feature_size / 2) dilated = offset(eroded, feature_size) result = offset(dilated, -feature_size / 2)
which performs an opening operation followed by a closing when
feature_size
is positive, or the reverses when it is negative.