mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 06:31:41 +00:00
With Invert Wrap, each piece of a line's band intersected the line's spans so far with the spans the wrap shape holds over that piece by comparing every pair of them. A wrap shape of many parts (a comb or a zigzag) gives a line many spans, and with an offset the band is cut into up to 128 pieces, so a dense shape made layout quadratic in the number of parts for every line. intersect_intervals now walks the two sorted lists once, stepping past whichever interval ends first, and gives the same spans in the same order. Tests compare it with the pairwise intersection on every list of non-overlapping intervals with ends among seven points, check that two interleaved lists of 3,000 and 2,000 intervals take at most 5,000 steps, and lay out a line inside a 500-tooth Invert Wrap comb with an offset.