Tuesday, January 9, 2007

object spacing around an ellipse

Another example of fixing something that probably nobody cares about, or even noticed. But it bugged me, and elsewhere, Johanna Hyacinth, who makes really nice jewelry, as well.

The problem with spacing things evenly around the perimeter of an ellipse is that it's not as easy mathematically as you'd think. There's not even an exact equation you can plug in to figure out WHAT the distance is around an ellipse, although there are good approximations. Even after you have that, there's no easy way to figure how to get at the evenly spaced spots (i.e., the "theta" in a parametric equation).

So, probably in the same way Johanna Hyacinth did it, I resorted to brute force calculations. (Essentially, it's using LSL to do approximate some integral calculus, which is NOT something I've had to think about for, well, more than a decade.) LSL is not designed to be particularly fast at calculations, so it slows things down a bit.

Does it matter, for example, for making skirts, as described in Natalia Zelmanov's blog? Probably not, because people's waists aren't "stretched" enough for it to be likely to show. But, it makes me feel better to know that I _could_ space the panels evenly, if I wanted to. But, for necklaces, like the ones that Johanna made, it's more important that the segments line up evenly.

Anyhow, below are pictures of loopRez ellipses. In the original version, the objects are not evenly spaced (you can see the objects bunched up at the long ends of the ellipse); in the new version, the objects are spaced a bit better.