'Ellipse drawing
I'm trying to draw an ellipse using only glVertex2i function, I'm letting the user to enter 2 foci points and a point on the ellipse. My question is: how to find the rest of the ellipse points.
Solution 1:[1]
Have a look here. The steps you have to do are:
- Transform your coordinate system such that the too foci points lie at
(-c,0)and(+c,0) - Compute the semimajor axis as
2*a = r1 + r2wherer1resp.r2are the distances between the given point and the foci points. - Compute the semiminor axis as
b*b = a*a - c*c - Now you can use the simple parametric form
x = a*cos(t)andy = b*sin(t)withtranging from0to2 pito create sample points on the ellipse. - Transform these points back using the inverse of the transformation from step 1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Danvil |
