Generally, run fixBound before this function. The ranges of a PolySet 's X and Y columns define the boundary. For each discrete polygon, this function determines if the first and last points lie on a boundary. If both points lie on the same boundary, it adds no points. However, if they lie on different boundaries, it may add one or two corners to the polygon.
When the boundaries are adjacent, one corner will be added as follows:
top boundary + left boundary implies add top-left corner;
top boundary + right boundary implies add top-right corner;
bottom boundary + left boundary implies add bottom-left corner;
bottom boundary + right boundary implies add bottom-right corner.
When the boundaries are opposite, it first adds the corner closest to a starting or ending polygon vertex. This determines a side (left-right or bottom-top) that connects the opposite boundaries. Then, it adds the other corner of that side to close the polygon.
Returns
PolySet identical to polys, except for possible additional corner points.