Many of the curves in this chart have some unsightly wiggles. That’s because, when a function of degree 2 or higher tries to approximate a piecewise constant, it tends to go back and forth across the target. So here instead I fitted each such function not to the piecewise constant directly but to the fit of the next lower degree.
So some accuracy in fit is lost – but this was useful practice for an application in which, perhaps oddly, that doesn’t matter.
Column 0 is the target. Column 1 is made of circle segments with G1 continuity, and some of the joins are easy to see. Column 2 is quadratic spirals with G2 continuity, and the improvement is clear. It’s much harder to find differences between G2, G3, G4; that may be partly due to the limitations of the cubic splines that imitate these transcendental curves.
This was also incidentally the first serious test of my piecewise polynomial object’s new integration method!
I don’t know how to efficiently break a transcendental curve into segments so that a cubic spline can match it within a given resolution. Need to think about that some.