Mail Archives: djgpp/1997/02/04/17:36:08
Benjamin D Chambers wrote:
>
>
> A(x+w)^2 B(y+h)^2
> -------- + -------- = 1
> C^2 C^2
>
Not quite : this is a general conic equation, which may repesent
ellipses, as well as parabolae and hyperbolae... In the above, if A and B
are both negative, the equation has no solution (so this is *nothing*),
if A and B are of opposite sign you get a hyperbola, and if any of them
is zero you get a parabola...
Only when A and B are both positive do you get an ellipse...
Here is my try at general conic equations (for conics centered on O):
A * (ux+vy)^2 + B * (px+ry)^2 = 1
with ur-pv!=0 and A and B not both zero, and not both negative
If A*B=0 this is a parabola
if A*B < 0 this is a hyperbola
if A*B > 0 this is an ellipse
As regards drawing ellipses, using equation is (IMHO) a bad thing : there
are fast scan lines algorithms for general ellipses : the description of
one can be found in Foley/van Dam, Computer Graphics, Principles and
Practice (2nd Ed.), in chapter 19.
Francois
- Raw text -