Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: 3D-plotting of quadric surfaces?
Date: Mon, 28 Jan 2008 20:39:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 61
Message-ID: <fnleh5$1ub$1@fred.mathworks.com>
References: <2008012813005216807-bastian@beckspcde>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1201552741 1995 172.30.248.38 (28 Jan 2008 20:39:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 28 Jan 2008 20:39:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:447994


Bastian Stahmer <bastian@beckspc.de> wrote in message 
<2008012813005216807-bastian@beckspcde>...
> Hello!
> 
> I'm trying to plot a quadric surface, which is given in cartesian 
> coordinates. To be precise, I'm searching for a way to plot a quadric 
> surface given in the general form [1]
> 
> 0 = A*X^2 + B*Y^2 + C*Z^2 + 2*D*X*Y + 2*E*X*Z + 2*F*Y*Z + 2*G*X + 
2*H*Y 
> + 2*I*Z + J
> 
> Depending on the values of the 10 coefficients this equation describes 
> an ellipoid, a hyperboloid, a paraboloid and so on. I tried to solve 
> the equation to z and create a surface, which works for non-complex 
> solutions but if you choose for example every coefficient to 0 and A, 
> B, C and J to 1, you get a Sphere with radius 1:
> 
> 0 = x^2+y^2+z^2-1
> and solved to z
>   (-x^2-y^2+1)^(1/2)
>  -(-x^2-y^2+1)^(1/2)
> 
> It's obvious that there are only real results for -x^2-y^2+1 > 0   -->  
>  x < 1 and y < 1. In addition to that, to fully display the sphere i'd 
> need to combine the two halves of the sphere given in the two solutions 
> of z. While this may be possible for such an easy surface as a sphere, 
> it seems impossible to me to do this for the generic equation.
> 
> So my question is how to display such quadric surfaces in general form.
> 
> Thank you,
> 
> Bastian.
> 
> [1] http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/geometry/
simple.html
----------
  You can simplify matters if you find the following eigenvectors and 
eigenvalues:

 [v,s] = eig([A,D,E;D,B,F;E,F,C];

In general, this and completing the squares will allow you to make a 
transformation determined by v to new cartesian coordinates x,y,z which 
satisfies

 a*x^2+b*y^2+c*z^2 = 1

if all the eigenvalues are nonzero.  Depending on the number of negative 
quantities in a, b, and c, this is either an ellipsoid, a one-sheeted 
hyperboloid, or a two-sheeted hyperboloid.  In case one of the eigenvalues is 
zero, you get either an elliptical, or a hyperbolic, paraboloid.  In each of these 
cases it should be relatively easy for you to define two parameters which are 
capable of generating the surface, in the manner mentioned by Ingo.  Of 
course there are various degenerate forms possible in these cases, but doing 
an eigenvector analysis is the key to understanding these quadratic surfaces.

Roger Stafford