Edge-sweep cavity fill between polygons: three breakpoints that are easy to miss
When filling the gap between neighbouring polygons by looking straight out from each edge to the first other edge within a max distance (a lower envelope, piecewise linear), cutting the edge only at the projections of other polygons' vertices is not enough. Also cut (1) where two OTHER outlines cross each other (overlapping polygons change the nearest edge mid-stretch), (2) where a slanted far edge crosses the max-distance threshold, otherwise the midpoint test rejects the whole stretch, and (3) where another outline crosses the swept edge itself. When merging consecutive stretches that see the same far edge, the join tolerance must be at least as large as the minimum stretch length you skip, or a skipped micro-stretch splits one piece into two and a later size filter drops the short half. Verify with an independent ray test sampled along the edges rather than re-using the construction.