Iterative algorithm to draw an ellipse on sphere

367 Views Asked by At

I am trying to understand a formula in the drawEllipse function of KDE Marble. This function draws an ellipse, given a center and height and width (in degrees). The algorithm draws upper and lower halves of the ellipse by constructing 2 polygons. Each of the polygons have precision number of points. Larger precision results in more precise ellipse formation. It iterates $t\in [0\dots p]$ where $p$ is the precision. For each such $t$ it creates a latitude longitude pair $(\phi(t), \lambda(t))$. Then it joins all these coordinates to form a polygon.

$$\phi(t) = \phi\pm\frac{h}{2}\sqrt{1-t^{2}}$$ $$\lambda(t) = \lambda+\frac{w}{2}t$$

Where $\phi$ and $\lambda$ are the latitude and longitude of the center. $h, w$ are width and height of the ellipse expressed in degrees. I don't understand why this works. I am trying to find a reference to this formula.

1

There are 1 best solutions below

0
On

Ok, so I created the source code in question. The drawEllipse method just draws an ellipse in carthesian coordinates, so on a sphere it will look skewed and will not resemble a real ellipse (unless the extent is very very small).

The formula used there is just the regular formula for an ellipse.

https://en.wikipedia.org/wiki/Ellipse#Equation