another problem with my clothoids
each curve hits alternate dots: first exactly, then with offsets pushing it toward the other curve.
I don’t think I’ve mentioned here how the offsets work. ( . . more . . )
another problem with my clothoids
each curve hits alternate dots: first exactly, then with offsets pushing it toward the other curve.
I don’t think I’ve mentioned here how the offsets work. ( . . more . . )
For context, see past posts in the curve-fitting category that I just created. To recap:
The curves I’ve been drawing are the paths made by a point moving at constant speed at an angle which is a piecewise quadratic function of path length. Curvature, the first derivative of angle, is continuous.
Such a path that hits a given sequence of dots is fully determined if it loops, but otherwise it has two degrees of freedom. For any angle and curvature at the starting dot, there is a quadratic coefficient that lets the path reach the next node, and likewise for the next.
My current code starts with an estimate for the length of each segment (between two dots) and the angle at its midpoint, and uses these basis functions to fit those angles: a constant, a linear function, and a family of “solitons”: piecewise quadratics, zero outside a sequence of four dots, discontinuous in the second derivative at each of those dots. For n segments, there are n-2 solitons, so the constant and linear functions are needed to consume the last two degrees of freedom.
Eventually I noticed a flaw in this scheme: the curvature of the resulting path is the same at both ends, namely the slope of the linear component, because the solitons contribute nothing to it. That’s appropriate for āCā, but wrong for plenty of other strokes; in āSā the end curvatures ought to have opposite sign.
The next thing I’ll try is a least-squares quadratic fit to the whole sequence, then fit the residues with solitons as before. That should be an improvement but it’s not ideal; curvature is a local feature. Perhaps I’ll think of something better later.
Early strips of some webcomics carry the author’s much later comments. Christopher Baldwin (Bruno) and David Willis (Roomies!) are reposting old series that ended. David Morgan-Mar’s (Irregular Webcomic!) schedule these days is two new strips and five comments on old strips each week.
If it were me, I think I’d want to keep coming back to older strips, with ever decreasing frequency. Perhaps like this:
if n even: n /= 2 comment on n while n even: n /= 2 add n to backlog else: pop a number from backlog and comment on it
Here, each curve hits alternate dots: first exactly (above), then with offsets pushing it toward the other curve. Below is the result of eight iterations.
With enough iterations, the top of ‘s’ eventually gets a more symmetrical arch, as the change in curvature is spread more evenly.
But many runs get stuck in the fitting phase, and I don’t yet know why. Attacking one likely flaw didn’t help.
(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.
( . . more . . )