mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-15 03:37:04 -04:00
Spatial properties move along their path by arc length: a table of 96 chords per segment, read back by linear interpolation of the curve parameter. Within each cell that mapping is linear, so the speed (the Graph Editor's speed graph, a central difference of the position) jumped at every cell boundary and was off by up to ~2 % on a curved path: a sawtooth over a constant-speed move, and a slight wobble in the motion itself. The table now holds Gauss-Legendre arc lengths, and `at_length` refines the cell's linear guess with Newton steps on the true arc length (|B'(u)| as the derivative), so position and speed follow the path exactly. Test: linear keys along a strongly curved path give a constant speed (within 0.1 %) at every sample; the old mapping was off by 2 %. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f