mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
A small closed loop whose fit collapsed to a single cubic (fit_closed), or a piece returning to its own junction with fewer than two fitted cubics (fit_piece), kept every positioned point as a straight segment. A looser Paths collapses more loops, so it could give more segments than a tighter one. Such a loop now tries the fewest segments that still hold it, each only if the result keeps an area (more than 0.25 px^2) and stays within 1.5 * max(tolerance, 0.5 px) of the points both ways: the fit at up to three somewhat tighter tolerances (what a slightly higher Paths gives); for a closed loop then two cubics split at its start and its farthest point, then the outline simplified at the tolerance and finer. The positioned points stay the last resort, as before. Test (code-drawn): a_higher_paths_never_gives_fewer_segments sweeps Paths 0/25/50/75/100 over 32 seeded 48 px images of soft blobs plus pixel noise in Color and Black and White at Noise 1 and 3. Before, six runs had fewer segments at a higher Paths (e.g. 125 -> 79 from Paths 0 to 25); after, none. One image (seed 16, Black and White: 140 -> 136 from Paths 0 to 25, with or without this change) has another cause and is left out of the sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tBcdwNhptqtmX32JCGFzB