3
$\begingroup$

I have ellipse in 2D. I want to compute fixed number of points on this ellipse with constant angular separation between those points.

My first idea was to generate line equations from center of the ellipse and then solve equations of these lines with ellipse equation. But it's not efficient computationally. Second idea is to use equation in polar coordinates and vary $t$ from $0$ to $2\pi$ with overlap $ {2\pi}/{NumberOfPoints}$.

What is the simplest (less computationally absorbing) method to get fixed ellipse points number?

  • 0
    I can't figure out $x$ and y from these equation. Also some good graphic representation of this equation would be helpful. I found some but still can't obtain what I need.2012-06-01

1 Answers 1

2

If you insist on having equal angular increments, the equations are:

$ k = \frac{1}{\sqrt{ {b^2}\cos^2{\theta} + {a^2}\sin^2{\theta} }}$

$ x = kab\cos{\theta}$

$ y = kab\sin{\theta}$

So, you have to compute a sine, a cosine, and a square root for each given value of $\theta$. Not too much for a typical modern computer, I would think.

But, since you are going to use equal increments of $\theta$, there's an old-time computer graphics trick that reduces the computation. Suppose we let $\delta\theta$ denote the angular increment. Then we know that

$ \cos(\theta + \delta\theta) = \cos\theta\cos\delta\theta - \sin\theta\sin\delta\theta $

$ \sin(\theta + \delta\theta) = \sin\theta\cos\delta\theta + \cos\theta\sin\delta\theta $

You pre-compute $\cos\delta\theta$ and $\sin\delta\theta$. Then you can compute each incremented value of $\cos(\theta + \delta\theta)$ and $\sin(\theta + \delta\theta)$ with just four multiplies and two adds.