mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-08 02:30:09 +00:00
The Live Paint faces were right; the Pathfinder regions over-counted. Two small circles inside a big one, touching each other at one point, gave the big circle's region only one of its two holes, and the other hole came out as a region of its own. linesweeper walks the boundary of the two touching holes as one loop and, when the walk comes back to the shared point, cuts the second hole off as a child of the first and flags it outer, as if it were an island inside it. face_groups trusted that flag, so the hole started a face. The same cut goes wrong the other way when an outer contour touches its own hole: the outer contour comes out as an island inside the hole. Such a loop winds the same way as the contour it was cut from, against its flag. face_groups now checks every contour's flag against its winding; a pass where any disagrees is grouped by geometry instead (each hole goes with the smallest outer contour of its mask around it). Passes where they all agree keep the sweep's tree as before, at the cost of one area per contour. Adds deterministic tests for both shapes of the bug and checks in the proptest regression seed.