Re: extracting angle info from ellipsoid equation



In article <ef5dba7.-1@xxxxxxxxxxxxxxxxxxxxxxx>, sophia
<sophiabano@xxxxxxxxxxx> wrote:

As an Postgraduate student i am doing a research project on object
detection using data fitting(ellipsoid) in 3D. i have calculated
rotated ellipsoid equation of the form:

Ax^2+By^2+Cz^2+Dxy+Exz+Fyz+L=0;

1)how can i plot this equation?
2)can i extract rotation angle from this equation?
3)how will in get to know that a particular data point it lying
within this ellipsoid or not?
-------------------
(I see John has already answered your question while I was preparing
this. However, I'll send mine to you anyway just in case there is
anything in it that helps to clarify matters.)

I will only undertake to answer questions 2) and 3).

If L were zero, this would be a degenerate ellipsoid, so we'll suppose
otherwise. Now convert the equation to the form

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

where a = -A/L, b = -B/L, c = -C/L, d = -D/(2*L), e = -E/(2*L), and f =
-F/(2*L).

By "rotation angle" I presume you are asking for the directions of this
ellipsoid's three principal axes. This is a problem in eigenvectors.
Form the symmetric matrix M and find its eigenvalues and eigenvectors:

M = [a d e;d b f;e f c];
[V,S] = eig(M);

This will give M = V*D*V' where V consists of three columns of mutually
orthogonal unit eigenvectors and D is a diagonal matrix with the three
eigenvalues along its diagonal.

Then we have the equations

a*x^2+b*y^2+c*z^2+2*d*x*y+2*e*x*z+2*f*y*z =
[x,y,z]*M*[x;y;z] =
[x,y,z]*V*D*V'*[x;y;z] =
[X,Y,Z}*D*[X;Y;Z] =
p*X^2 + q*Y^2 + r*Z^2 = 1

where [X,Y,Z] = [x,y,z]*V and p, q, and r are the three diagonal
eigenvalues in D. Thus the eigenvector columns of V define a new rotated
coordinate system, X, Y, Z in which the above equation takes the simpler
form

p*X^2 + q*Y^2 + r*Z^2 = 1.

This surface will clearly be an ellipsoid if and only if these three
eigenvalues are all positive numbers. In that case the square roots of
their reciprocals will be the three semi-principal axes lengths, and the
three eigenvectors are unit vectors in these three axes' directions. This
is the answer to your question 2). That is, the components of these unit
vectors are the direction cosines of the three directions along the
principal axes with respect to the original (x,y,z) coordinate system.

Question 3) is easy. A point (x,y,z) lies inside the ellipsoid if and only if

a*x^2+b*y^2+c*z^2+2*d*x*y+2*e*x*z+2*f*y*z <= 1

Roger Stafford
.



Relevant Pages


Loading