5
$\begingroup$

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.

  • 0
    Begin by learning elliptic integrals of second kind and how it connects to eccentricity and arc length of an ellipse.2017-01-11
  • 0
    Thank you but as I said I need an approximation, for an app implementation.2017-01-11
  • 0
    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.2017-01-11
  • 0
    See also http://gamedev.stackexchange.com/questions/1692/what-is-a-simple-algorithm-for-calculating-evenly-distributed-points-on-an-ellip2017-01-12

3 Answers 3

3

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

  • 0
    Nice formula. what is t, is it a length? If so, given the number of points instead of the length, can I use Ramanujan's approximations of ellipses' perimeter to find t?2017-01-11
  • 0
    And also, pardon my ignorance, what is O(e8)?2017-01-11
  • 1
    $t$ is corrected angle such that the arclength is proportional to $t$. $O(e^8)$ means the error/remainder terms have order of magnitude of $e^8$ (see more on [**big O notation**](https://en.wikipedia.org/wiki/Big_O_notation).)2017-01-11
  • 0
    So in your example, t = ( 2 * PI / n ) - right?2017-01-11
  • 0
    @Beppi's That's right!2017-01-11
  • 0
    Marvelous!! It works like a charme, fantastic, thank you!2017-01-11
  • 0
    Could you give a reference for this formula?2017-01-13
  • 0
    @lhf That's my original work.2017-01-13
  • 0
    Thanks for your original work, it was referenced in my library, here: https://github.com/BeppiMenozzi/ArcPageIndicator2017-01-22
2

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

  • 0
    I adopted the other solution, it was more straight forward for my noobbness, thank you anyway.2017-01-11
2

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

parallelogram method

(Image by Wikipedia user Cmarm.)