6

For an app, I want to equally distribute a certain number of points on the perimeter of a known ellipse, and, to draw them, I need to know, for every point, the angle of the line that connects it to the center of the ellipse.

Here is an horrible drawing of what I must achieve: number of the points is known, distance of the points on the ellipse is constant (or at least should be) but unknown (well, it is circumference/number of points), horizontal and vertical radiuses are known, I look for the angles a0-an

ellipse

I already know that this is a not easy problem, that does not have a finite solution. The fact is that I don't need perfection in the points distribution, but I need speed in the calculation of the positioning.

Is there a way or an easy formula that approximates the real solution? Some altorithm that makes it possible to be implemented?

Thank you in advance.

Beppi's
  • 173
  • Begin by learning elliptic integrals of second kind and how it connects to eccentricity and arc length of an ellipse. – Narasimham Jan 11 '17 at 16:38
  • Thank you but as I said I need an approximation, for an app implementation. – Beppi's Jan 11 '17 at 16:39
  • How large will the eccentricity get? A power series approximation might work, but the larger the eccentricity is, the more terms you'll need in the power series. – Michael Seifert Jan 11 '17 at 16:57
  • See also http://gamedev.stackexchange.com/questions/1692/what-is-a-simple-algorithm-for-calculating-evenly-distributed-points-on-an-ellip – lhf Jan 12 '17 at 15:42

3 Answers3

7

For a small eccentricity $e$,

\begin{align*} e^2 &= 1-\frac{b^2}{a^2}\\ \theta(t) &= t+\left( \frac{e^2}{8}+\frac{e^4}{16}+\frac{71e^6}{2048} \right) \sin 2t+ \left( \frac{5e^4}{256}+\frac{5e^6}{256} \right) \sin 4t+ \frac{29e^6}{6144} \sin 6t+O(e^{8}) \\ \begin{bmatrix} x \\ y \end{bmatrix} &= \begin{bmatrix} a\cos \theta(t) \\ b\sin \theta(t) \end{bmatrix} \end{align*}

the arclength spacing is approximately equal for uniform spacing of $t\in [0,2\pi]$.

enter image description here

See also my newer post here.

Ng Chung Tak
  • 18,990
4

Here is a simple algorithm that distributes points evenly on an ellipse:

  1. Sample the ellipse uniformly according to angle using the polar parametrization.

  2. Replace each point with the midpoint of its neighbors.
    Project the midpoint ortohogonally onto the ellipse.

  3. Repeat step 2 as needed.

enter image description here

lhf
  • 216,483
4

Perhaps the parallelogram method is suited to your purpose? Here it is in action:

parallelogram method

(Image by Wikipedia user Cmarm.)

TonyK
  • 64,559