The current link placement algorithm LinkRez uses places the centers of links precisely on the desired chain link path. However, with large links on highly "curved" parts of necklaces (generally, the very front, or very back), the front and back ends of the link can be slightly misaligned with preceeding and following links.
I realized that if I completely re-worked the fundamental link placing algorithm, to instead place the front and back ends of each link precisely, and permitting the center of the link to lie inside the ideal necklace chain path, these gaps should be eliminated, or at least reduced. I think more people would prefer gap elimination over adherence of theoretical link centers to an arbitrary mathematical path construct of my own design. At least I hope so, considering the rather large effort it's going to take to re-write it.
Worse yet, the main LinkRez script is now getting rather large. In the limited 16 kilobytes of memory available to a script, I have less than 800 bytes of free memory left. Because of the large number of interdependent calculations, there really isn't a good way to "split" the functions across multiple scripts, so I'm going to have to pore through the script, looking for minor memory inefficiencies to improve.
Edited to add: oh my, a MAJOR re-write only introduced a few fixable problems, and was actually much less painful than I thought it'd be (maybe I'm actually getting better at this!). The restructured script:
- improved precision of link placement, for fewer gaps, especially with bigger links
- fixed a glitch in the transition from "front half" to "back half" of the necklace
- simplified the algorithm logic
- freed up ~700 bytes of memory, almost doubling the remaining memory