
Re: Dividing an ellipse into equal parts
Posted:
Mar 2, 2006 7:49 PM


On Thu, 02 Mar 2006 14:25:29 0800, tallsteve wrote:
> I'm trying to move items around an ellipse as part of an animation. If > I move round the ellipse in constant angular movements from the centre, > then the item moves faster when near to the centre of the ellipse and > slower round the ends. > > (If my ellipse is 2w wide and 2h high, and the angle from the centre is > a, then I get the coordinates by x = w sin a and y = h cos a).
If this is just for an animation, you'll probably be happy with an approximate solution, which you can get with calculus.
You want sqrt(dx^2 + dy^2) to be a constant C. Taking derivatives, dx = w cos a da dy = h sin a da C^2 = dx^2 + dy^2 = (w^2 cos^2 a + h^2 sin^2 a) da^2
da = sqrt(C^2 / (w^2 cos^2 a + h^2 sin^2 a))
So plug in C, w, h, and a, and you'll get approximately the amount by which you should increment a to move a distance C around the circumference.
If you're animating infrequently but need more accuracy, then separate each animation step into multiple approximation steps  if the error you get using 30 steps is too high, for example, you can get about 1% of that error by taking 300 steps and only plotting every tenth.  Roy Stogner

