Sunday, 2018 February 11, 11:14 — curve-fitting


(Previously: 2014, 2011, 2010; also, less closely related, 2015)

I tried to smoothen a stroke by shifting each dot toward the Euler spiral (aka clothoid, aka Cornu spiral) determined by its four nearest neighbors. That didn’t work so well: small wiggles were removed, but big ones were magnified.

Which reminds me that I considered naming the project Meander, but then thought no, the point is to remove meanders. (For now I’m calling it Thalweg, until a better name occurs to me.)

The flaw in my thinking is that I don’t want any Euler spiral, I want one in which curvature changes as slowly as possible: that is, one that is locally very like a circle.

So the logical thing to do is to shift the dot toward the circle defined by three neighbors; or rather, since that would introduce an undesirable asymmetry, the circle that fits the two immediate neighbors exactly and misses the next two by equal distances. I haven’t worked out how to do that; I’ll probably simply fit two circles and split the difference.

I’m also working on another approach: fit two curves exactly to alternating dots, and adjust each dot according to the other curve. Though this uses piecewise Euler spirals, I hope the discipline of global constraints will prevent the exuberance seen above.

Subscribe without commenting

RSS feed for comments on this post.

Leave a comment