# Calculating equidistant points around an ellipse arc

As an extension to this question on equiangular fisheye distortion, how can I calculate equidistant points around an ellipse (or 1/4 segment of) given it's aspect ratio?

When it's circular, I can use a simple angle around the central point, but as the aspect ratio gets smaller, the length of the arc gets shorter and the angles are no longer equidistant.

Thanks.

-
The problem you have is that the arclength of an ellipse is a so-called elliptic integral, which is nonelementary (but easily computed numerically, see this related question), and is not easily inverted. Are you fine with a numerical solution? – J. M. Jul 19 '12 at 8:00
Oh, no wonder I couldn't figure it out on my own... :) What do you mean by a numerical solution? (as opposed to a formula?) – Deanna Jul 19 '12 at 8:09
– joriki Jul 19 '12 at 8:25
Yes, I am saying that you will have to resort to numerical methods to do what you want. If you're interested, I can sketch up an algorithm for you in an answer... – J. M. Jul 19 '12 at 10:51
If you can, that'd be useful. Thanks. – Deanna Jul 19 '12 at 11:13

I assume that by “equidistant” you mean that the arc length along the ellipse between any two adjacent points is the same, not the Euclidean distance between the points in the plane.

# Complete circumference

Computing the circumference of an ellipse can be formulated using the complete elliptic integral of the second kind. More precisely, the circumference is

$$c=4a\,E(m)\qquad m=1-b^2/a^2$$

at least if you formulate the elliptic integral in terms of the parameter $m=1-b^2/a^2$. If you instead define it in terms of the elliptic modulus $k=\sqrt m$, then you plug that into the formula. So now you know the total circumference, and can divide that by some integer $n$ depending on how many points you want along the perimeter. Then integral multiples of that length will yield equidistant points.

# Point at given arc length

Next you need to turn arc length back into position on the ellipse. This means you'll have to compute the inverse of the incomplete elliptic integral of the second kind. So for the $k$-th point (for $0\le k<n$) you'd numerically solve

$$\tfrac knc=a\,E(\varphi|m)$$

for $\varphi\in[0,2\pi)$ and then either turn that amplitude back into an angle or compute the position directly from that. To turn the amplitude into an angle, this post suggests using the formula

$$\theta=\varphi+\tan^{-1}\left(\frac{(a-b)\tan(\varphi)}{b+a\tan^2(\varphi)}\right)$$

which I haven't checked but only adjusted for the notation I'm using here. That angle is relative to the minor axis, so you might want to add $\frac\pi4$ to that. To compute coordinates directly from the amplitude, you can use

$$x = a\sin\varphi\qquad y = b\cos\varphi$$

The above will have the first point (for $k=0$) on the positive $y$ axis, at the end of the minor axis. If you want to, you can offset all arc lengths in order to shift the points along the ellipse, e.g. to the end of the major axis.

# Example

Here is an example for $a=5, b=3, n=17$:

$$\begin{array}{rccccc} k & \varphi & x & y & \theta \\\hline 0 & 0.0000000 & +0.0000000 & +3.0000000 & 0.0000000 \\ 1 & 0.3032641 & +1.4931847 & +2.8631004 & 0.4807207 \\ 2 & 0.6256782 & +2.9282358 & +2.4316983 & 0.8777733 \\ 3 & 0.9945508 & +4.1925715 & +1.6346388 & 1.1990363 \\ 4 & 1.4462325 & +4.9612598 & +0.3727257 & 1.4958100 \\ 5 & 1.9329168 & +4.6757386 & -1.0627741 & 1.7942945 \\ 6 & 2.3395668 & +3.5938304 & -2.0857560 & 2.0966579 \\ 7 & 2.6809206 & +2.2227512 & -2.6872618 & 2.4505185 \\ 8 & 2.9910709 & +0.7497699 & -2.9660789 & 2.8939978 \\ 9 & 3.2921144 & -0.7497699 & -2.9660789 & 3.3891875 \\ 10 & 3.6022648 & -2.2227512 & -2.6872618 & 3.8326668 \\ 11 & 3.9436185 & -3.5938304 & -2.0857560 & 4.1865274 \\ 12 & 4.3502685 & -4.6757386 & -1.0627741 & 4.4888908 \\ 13 & 4.8369528 & -4.9612598 & +0.3727257 & 4.7873754 \\ 14 & 5.2886345 & -4.1925715 & +1.6346388 & 5.0841490 \\ 15 & 5.6575071 & -2.9282358 & +2.4316983 & 5.4054121 \\ 16 & 5.9799212 & -1.4931847 & +2.8631004 & 5.8024646 \end{array}$$

-
I've accepted this as it looks it it gives what I wanted, but the project that required this was dropped a while ago. Thanks – Deanna Feb 4 '15 at 15:24
@Deanna: thanks for accepting. I noticed this while investigating possible duplicates related to arc lengths on conics, and decided that I liked this question more than that one. Now that you have an accepted answer here, we might be able to establish this here as the canonical question on the subject. – MvG Feb 4 '15 at 16:46