Message-ID: <32F7B70A.149B@pobox.oleane.com> Date: Tue, 04 Feb 1997 23:24:10 +0100 From: Francois Charton Organization: CCMSA MIME-Version: 1.0 To: Benjamin D Chambers CC: djgpp AT delorie DOT com Subject: Re: Ellipses (again) References: <19970203 DOT 185314 DOT 4575 DOT 7 DOT chambersb AT juno DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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