I left for a two week holiday, pondering the ordering bug I'd uncovered in my current script and the fact that matlab provides built-in functions for a lot of what I was doing.
The fact that I had to choose between working in three dimentions, and in two, gave me pause for thought. If I were to use just the points on the surface of the sphere as input to matlab's voronoin routine, everything would come together at the center. Instead, I add the origin to my list of points, and remove it again later. Each triangle in the Delaunay triangulation is in fact the tetrahedron formed by three points on the surface, and the center of the sphere; the center of this tetrahedron is normalised to the surface of the sphere.
As well as learning about the appropriate built-in functions, I tidied
up my script a bit, and made it actually a function, not just a .m file,
so that I could run it with different arguments easily. I separated
out the drawing so that whether it's a sphere or an ellipsoid (or just
a matlab plot) is a command line argument. You can see the script as it was
when I made this model here. An up to date version
will come later.
Along the way, I wrote genpoints.m, which is still very much a work in progress, but which provides various ways to space out the points on a sphere. It both accepts and returns a nx3 matrix of points, and can iteratively move them apart or or do other spacing tricks. You can find this script here.
The spiral, this time, is an Archimedes' spiral, with the points spaced along it with an interative routine that nudges them off the spiral in whatever direction, then normalises them to the nearest point on it.
The whole thing is projected onto an oblate spheroid (flattened sphere) mostly because I already had the code to do. It's handy for keeping it from rolling away, but not really relevant. I suppose I should change ellipsoid to spheriod throughout, since I've only been stretching it along one axis.
Cells that are adjacent to each other as you go down the spiral have
the edge between them gold on one side, and red on the other. Other
edges are black. The PostScript code for this one
is only one page, since it's fairly small.