Message Boards Message Boards

Calculate the angle of an ellipse from it's matrix representation?

GROUPS:

Hello,

I have generated a bunch of points then fed them to :

ellipse =BoundingRegion[points, "FastEllipse"].

The output is :

Ellipsoid[{0, 0}, {{0.0698865, 0.0545128}, {0.0545128, 0.0698865}}].

My question is: using the weighted matrix in the output – {{0.0698865, 0.0545128}, {0.0545128, 0.0698865}} – how can I calculate the angle of the ellipse ?

Many Thanks, Andrew

POSTED BY: andrew gerzso
Answer
2 months ago

Are these the angles you're after?:

ArcTan @@@ Eigenvectors@{{0.0698865, 0.0545128}, {0.0545128, 0.0698865}}
%/Degree
(*
{0.785398, 2.35619}
{45., 135.}
*)
POSTED BY: Michael Rogers
Answer
2 months ago

Your answer goes in the right direction I think. But for example I am not sure how to interpret a negative angle such as in:

ArcTan@@@Eigenvectors@{{0.0749932,-0.128978},{-0.128978,0.406223}}
%/Degree
Out[97]= {1.90163,-2.81076}
Out[98]= {108.955,-161.045} <<< this negative angle.

In any case thank you for your answer !

POSTED BY: andrew gerzso
Answer
2 months ago

Hello Michael, This is definitely a step forward for me ! However I am not sure how to interpret negative results. For example:

ArcTan @@@ Eigenvectors@{{0.0749932, -0.128978}, {-0.128978, 0.406223}}
%/Degree
Out[93]= {1.90163, -2.81076}
Out[94]= {108.955, -161.045} <<<<<<<<<<<<<<< here 

Many thanks ! Andrew

POSTED BY: andrew gerzso
Answer
2 months ago

The range on ArcTan[x,y] per the docs is -Pi to Pi. Negative angles represent angles measured clockwise from the positive x axis, as in standard trigonometry. They will lie in quadrants III and IV if they are between -Pi and 0. You can add Pi or a 180 degrees to them and get a collinear angle that corresponds to the angle of the eigenvector -v, if v is the vector returned by Eigenvectors[] corresponding to the negative angle. (Any nonzero multiple of an eigenvector is also an eigenvector.)

POSTED BY: Michael Rogers
Answer
2 months ago

Hello Michael, My last post was more a comment than a question but thanks for your reply. I am active in digital photography and am currently working on color distance questions where ellipses play an important role. Ellipses represent areas of colors inside of which all colors may be considered as equivalent. Being able to know or double-check the size and orientation of the ellipse is fundamental. So your help above is greatly appreciated ! Best Regards, Andrew PS I think I should brush up on Eigenvectors !

POSTED BY: andrew gerzso
Answer
2 months ago

Group Abstract Group Abstract