mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
With Method Abutting and Shapes on, a region recognised as a shape had its outline replaced by the exact shape, but the region across that edge kept its fitted curve unless it was a hole filled by one colour, and even then the hole was recognised on its own, with its region's combined hardness. A shape touching a junction (a third colour, or its own colour at a corner) or the image's border was replaced on one side only, so abutting colours parted or overlapped along the shared edge, and a square on the image's corner could reach past the frame. Cause: Layers::layer recognised an island with no holes (`[only] => shapes::recognise`) regardless of what lay around it, and a hole only by `one_colour_within`, each from its own outline and hardness. Fix: under Abutting a shape is applied only where both faces take it (`Layers::shared_shape`): the loop has no junction on it and does not touch the border, the island has no holes and the hole holds one colour, and the shape stays inside the image. The shape is recognised from the outline turned one way and started at its leftmost anchor, with that loop's own hardness, so the island and the hole it fills get the very same shape. Overlapping is unchanged. Test: shapes_keep_abutting_neighbours_watertight traces three code-drawn anti-aliased colour images (a disc in a square plus a disc across its edge, shapes on the border, tilted tiles) and checks every outline lies within 0.001 px of a neighbour and a 4 x 4 per-pixel grid is covered exactly once. Before: gaps of 0.50, 15.1 and 0.73 px, 183 and 276 points uncovered or doubled; after: 0 px, 0 points. Isolated shapes are still recognised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tBcdwNhptqtmX32JCGFzB