Wednesday, 2018 February 28, 21:14 — curve-fitting

another problem with my clothoids

I wrote:

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 . . )

Sunday, 2018 February 25, 09:57 — curve-fitting

clothoid weekend update

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.

Wednesday, 2018 February 14, 23:20 — curve-fitting


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.

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.

( . . more . . )

Monday, 2017 July 3, 19:43 — eye-candy, mathematics

mutant dragons

In 2007 I thought of a pretty way to paint a square so that all pixels are different, but similar colors are clustered. For each pixel, set x,y to its coordinates; if their sum is odd, set the low bit of one of the color channels to 1. Replace x,y with (-x+y)>>1, (-x-y)>>1; this has the effect of rotating the grid by 3/8 turn and shrinking it by a factor of √2, so that the former even points, which formed a larger oblique grid, now fall on the original grid, and the odd points have their new half-coordinates truncated away. Repeat until a bit has been assigned to each bit of the three color channels.

Colors that match in their higher bits form twindragon fractals, thus:

In 2012, I thought: what if the rotation alternates clockwise and counterclockwise?

A bit on the boring side.

But in 2017, I thought: what if the sequence of left and right turns is randomized? ( . . more . . )

Sunday, 2016 July 24, 12:57 — mathematics

points problems pointers problems

Two-fifths of the links in my sphere arrangements page were broken. Ouch! I found new addresses for a few of them, and used the Wayback Machine for the rest.

Wednesday, 2016 May 25, 09:54 — mathematics

adaptive sampling

I got an interesting idea today.

As you may already know, I’ve been making models of Klein bottles an’ stuff; heretofore they’ve all been in the form of bent rods, but where possible I’d prefer a continuous surface. (A hollow body must have holes so that unused powder can be shaken out; but not all of my designs have enclosed spaces.) How to place a minimum number of vertices so that deviations from the abstract shape are within the resolution of the process? That’s less obvious with more degrees of freedom.

So, today’s idea. Start with an arbitrary set of sample nodes (in the abstract space of the parametric variables, rather than on the target surface itself), and their Delaunay triangulation. Along each edge of the triangulation, measure the deviation of the surface from a straight line; this gives the edge a weight. Move each node to the weighted average of its neighbors (with a bit of noise); thus, an edge whose image is strongly curved gets shorter.

After the movement phase, each edge ought to be checked, whether it’s still a Delaunay edge or needs to be replaced by the other diagonal of the quadrilateral formed by its two triangles. I don’t yet have criteria for adding nodes where existing nodes are too far apart, or merging them if they become redundant.

Next Page »