Verified that I didn’t make any mistakes in the formula, finally searched for an existing solution. Turned out that the hammer I had didn’t match the nail, and B-splines were the way to go. This just worked.
To my defense: I didn’t have internet when I was thinking this up. 🙈
A Mastodon instance for info/cyber security-minded people.