From: "Earl F. Glynn" Newsgroups: borland.public.delphi.graphics References: <3ac14368_1@dnews> <3ac14c7c$1_2@dnews> <3ac15184$1_1@dnews> Subject: Re: Parametric equations for an ellipsoid (ie. ellipsoid coordinate system)? Date: Tue, 27 Mar 2001 22:44:37 -0600 Lines: 86 Organization: efg's Computer Lab X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 65.64.124.126 Message-ID: <3ac16d6b_1@dnews> X-Trace: 27 Mar 2001 20:49:47 -0800, 65.64.124.126 Path: dnews!65.64.124.126 Xref: dnews borland.public.delphi.graphics:36803 "Paul Nicholls" wrote in message news:3ac15184$1_1@dnews... > Sorry about not explaining clearly enough at the start Earl :-/ Sorry I'm being a bit dense on this tonight. I discovered I'm a bit rusy with my 3D math. I hope I get this right: Let's consider a 2D ellipse first: x^2/a^2 + y^2/b^2 = 1 This can be drawn in the XY plane (Z = 0) with a single angular parameter. Let's use theta: x = a*cos(theta) y = b*sin(theta) Why does this work? If you plug the expressions for x and y back into the ellipse equation, you get: cos^2(theta) + sin^2(theta) = 1, which is a well-known trig identity. We can draw an ellipsoid as a series of elliptical "slices" along the z-axis, from zMin to zMax with some apprpropriate regular interval. Start with the ellipsoid formula: x^2/a^2 + y^2/b^2 + z^2/c^2 = 1 If we know z, we can easily get the appropriate XY ellipse equation for the "z" slice: x^2/a^2 + y^2/b^2 = 1 - z^2/c^2 But we need this equation to look like the equation at the top: x^2/[a^2 * (1 - z^2/c^2)] + y^2/[b^2 * (1 - z^2/c^2)] = 1 This means the z-slice ellipse equation as a function of theta is: x = SQRT(a^2 * (1 - z^2/c^2)) * cos(theta) y = SQRT(b^2 * (1 - z^2/c^2)) * sin(theta) Draw the z-slice by varying theta from 0 to 2 PI with some appropriate increment. After drawing the z slices from zMin to zMax, x slices can be drawn that are perpendicular to the z slices. This time we assume we know xMin to xMax for the ellipsoid. Start again with the ellipsoid formula: x^2/a^2 + y^2/b^2 + z^2/c^2 = 1 If we know x, we can easily get the appropriate YZ ellipse equation for the "x" slice: y^2/b^2 + z^2/c^2 = 1 - x^2/a^2 But we need this equation to look like the equation at the top: y^2/[b^2 * (1 - x^2/a^2)] + z^2/[c^2 * (1 - x^2/a^2)] = 1 This means the x-slice ellipse equation as a function of theta is: y = SQRT(b^2 * (1 - x^2/a^2)) * cos(theta) z = SQRT(c^2 * (1 - x^2/a^2)) * sin(theta) Again, the theta parameter needs to vary from 0 to 2*PI in some appropriate increment. And if you want to, you could form y slices with XZ ellipses. Maybe this approach would get you regularly-spaced coordinates for an ellipsoid. This is the same approach as drawing a sphere as a series of circles http://homepages.borland.com/efg2lab/Graphics/SphereInCube.htm -- efg efg2@efg2.com Earl F. Glynn, Overland Park, KS USA efg's Computer Lab: http://www.efg2.com/Lab Mirror: http://homepages.borland.com/efg2lab/Default.htm