heal

photonforge.heal(operand, feature_size)

Heal a set of polygons by removing small features.

Healling uses an opening and closing sequence of morphological operations to eliminate small features from the polygon set.

Parameters:
  • operand – Polygon, Path, Reference, Component or sequence of those. All polygons are joined before the operation.

  • feature_size – 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:

List of resulting polygons.

Note

The implementation is equivalent to:

eroded = offset(operand, -feature_size / 2)
dilated = offset(eroded, feature_size)
result = offset(dilated, -feature_size / 2)

wich performs an opening operation followed by a closing when feature_size is positive, or the reverese when it is negative.