# n equidistant points on circumference of an Ellipse [duplicate]

I want to generate a list of n coordinate points which are on the circumference of an ellipse. I wrote this code:

n = 150;

ellipseFunc[a_,b_,t_] := {(a*b*Cos[t]/Sqrt[b*b*Cos[t]*Cos[t] + a*a*Sin[t]*Sin[t]]), (a*b*Sin[t]/Sqrt[b*b*Cos[t]*Cos[t] + a*a*Sin[t]*Sin[t]])};

listell = Table[ellipseFunc123[4, 1, (i - 1)*2*Pi/n], {i, 1, n}];

Graphics[{Red, PointSize[0.01], Point@listell, Blue,Circle[{0, 0}, {4, 1}]}]


This results in an image like this

However, I want the n points to be equidistant on the circumference of the ellipse. The problem with this approach is that of taking equal angles to compute coordinates. I checked onto this question for circle. But most of the answers take similar approach which works well for a circle but not for an ellipse.

• Now, which of these two is appropriate for your problem? – J. M.'s ennui Oct 15 '15 at 14:50
• (In fact, things are slightly easier here than in the general case, since the elliptic integral of the second kind (EllipticE[]) is built-in.) – J. M.'s ennui Oct 15 '15 at 14:53

As @JM pointed out, this has been discussed before. My favorite method was mentioned by Vitaly Kaurov in his answer to this question: Generating evenly spaced points on a curve, and it relies on letting ParametricPlot do all the work for you by using the MeshFunctions -> {"ArcLength"} option (here I am using ellipseFunc, i.e. your own parametrization of the ellipse, with some arbitrary numbers):

points = Cases[
Normal@
(plot = ParametricPlot[
ellipseFunc[10, 3, t], {t, 0, 2 Pi},
Mesh -> 45, MeshFunctions -> {"ArcLength"}
]),
Point[l_] -> l, Infinity
];

Show[
plot, Graphics[{PointSize[0.015], Red, Point@points}],
AspectRatio -> Automatic
]


As a side note, ParametricPlot returns a form of Graphics that uses a GraphicsComplex object and "relative coordinates" (for lack of a better term). However, it is easier to deal with absolute coordinates, so I turned the GraphicsComplex into a plain Graphics object using Normal before extracting the Point expressions.

• I use "indexed" and "actual" coordinates myself, not knowing if there is more standard terminology. – J. M.'s ennui Oct 15 '15 at 16:14
• @J.M. I like "indexed": that makes sense to me. That's what I should call them from now on! – MarcoB Oct 15 '15 at 16:38

J.M.'s suggestion to use EllipticE can be implemented like this:

sample[t_, {a_, b_}] := {a Cos[theta], b Sin[theta]} /. FindRoot[b EllipticE[theta, 1 - a^2/b^2] - t, {theta, 0}]

samples[n_, {a_, b_}] := Module[{perimeterLength},
perimeterLength = 4 b EllipticE[1 - a^2/b^2];
Table[sample[t, {a, b}], {t, 0, perimeterLength, perimeterLength/n}]
]

ListPlot@samples[45, {10, 3}]


Of course, ArcLength can be used just as well, but I thought I should post this as it distinguishes this question from the previous ones.

• C. E., nice! Thanks for putting this together; I was curious to follow up on that suggestion myself to see how it would be used. (+1) – MarcoB Oct 15 '15 at 16:40
• We are fortunate here that Mathematica is able to evaluate the elliptic integrals when the parameter (second argument) is negative. In most other computing environments, the parameter is restricted to the interval $[0,1)$; in which case, the arclength function used is a (EllipticE[t + π/2, 1 - (b/a)^2] - EllipticE[1 - (b/a)^2]), and the circumference is thus 4 a EllipticE[1 - (b/a)^2]. Note that in this formulation, the parameter is equal to the square of the ellipse's eccentricity. – J. M.'s ennui Oct 15 '15 at 16:57