Ellipse - Correct angle calculation

129 Views Asked by At

I need to calculate a point on ellipse based on elliptic rotation angle. Though I am using the same formula as for circle (a = horizontal radius, b = vertical radius): $$ x = a * cos(\alpha) $$ $$ y = b * sin(\alpha) $$

Wierd thing is happening as per the following diagram: ellipticAngle

Searching online I find that my formula is the standard formula of calculation - however, as per my understanding (and maybe I am missing something), 45degrees should be in exact 50% from start point (0) to straight angle (90deg.) So if we go in radians, computer using it for easy arc calculation. Here it becomming somehow incorrect....

The question: Is there any way to "correctly" calculate rotation angle so it follows up rotation length (like in circle radians are)?

Thanks a lot

2

There are 2 best solutions below

0
On

Ellipses are really hard to work with, since there is no simple, exact formula for their perimeter. (There are simple formulas but they are not exact, and there are exact formulas but they are not simple.) Constant increase in angular measure does not correspond to a constant increase in arclength, so special tools are needed that are beyond my knowledge and understanding.

2
On

Given an ellipse of parametric equations:

$$ (x,y) = (a\cos\alpha,b\sin\alpha) \quad \quad \quad \text{with} \; \alpha \in [0,2\pi) $$

the length of an arc between $\alpha=0$ and $\alpha=\beta$ is defined as:

$$ \mathcal{L}(\beta) := \int_0^{\beta} \underbrace{\sqrt{(a\sin\alpha)^2+(b\cos\alpha)^2}}_{f(\alpha)}\,\text{d}\alpha\,. $$

Therefore, set $\Delta\beta \equiv 2\pi/n$, expanding $\mathcal{L}$ into first order Taylor series:

$$ \mathcal{L}(\beta+\Delta\beta) \approx \mathcal{L}(\beta) + \mathcal{L}'(\beta)\,\Delta\beta $$

it's possible consider the following numerical procedure (Euler's method):

$$ \begin{cases} \beta_0 = 0 \\ \mathcal{L}_0 = \dots \\ \end{cases} \quad \quad \quad \begin{cases} \beta_i = \beta_{i-1} + \Delta\beta \\ \mathcal{L}_i = \mathcal{L}_{i-1} + f(\beta_{i-1})\,\Delta\beta \\ \end{cases} \quad \quad \quad i = 1,2,\dots,n $$

through which we can achieve our goal in two steps:

  • let $\mathcal{L}_0 = 0$, it's possible to calculate the length of the ellipse $\mathcal{L}_e\equiv\mathcal{L}_n$;

  • let $\mathcal{L}_0 = -\lambda\,\mathcal{L}_e$ with $0 < \lambda < 1$, it's possible to calculate the desidered angle $\beta_{\lambda}\equiv\frac{\beta_{m-1}+\beta_m}{2}$, where $m<n$ is the index for which it's possible to stop the procedure when $\mathcal{L}_{m-1}\cdot\mathcal{L}_m<0$.

Finally, the angle $0 \le \gamma_{\lambda} < 2\pi$ between the vectors $(1,0)$ and $(x,y) = (a\cos\beta_{\lambda},b\sin\beta_{\lambda})$ is:

$$ \gamma_{\lambda} = \begin{cases} \arccos\left(\frac{x}{\sqrt{x^2+y^2}}\right) & \text{if} \; y \ge 0 \\ 2\pi - \arccos\left(\frac{x}{\sqrt{x^2+y^2}}\right) & \text{if} \; y<0 \\ \end{cases} $$

where only in the particular case of the circle $a=b$ we have $\gamma_{\lambda}=\beta_{\lambda}$ for all $\beta_{\lambda} \in [0,2\pi)$.