logo back up home forward   further reading more topics »

Maths - Conversion Matrix to Axis Angle

By: Vladimir Smutny - smutny
file Matrix to Axis Angle slight correction  
2006-05-10 11:30

Dear Mr. Baker, 
I believe that the Java(?) code on the page 
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm 
does not reflect sign analysis done in the table. 
When there is some of the vector component close to zero, then sign of the other components depend on the sign of nondiagonal terms which is not reflected in the code. So the relevant part of the code shall probably read instead of  
if (xZero && !yZero && !zZero) y = -y; 
else if (yZero && !zZero) z = -z; 
else if (zZero) x = -x; 
 
but  
if (xZero && !yZero && !zZero)  
if (!yzPositive) y = -y; 
else if (yZero && !zZero) 
if (!xzPositive) z = -z; 
else if (zZero)  
if (!xyPositive) x = -x; 
 
I am not sure about syntax but I am quite positive about the fact (my implementation is in Matlab, so I cannot copy working code). 
 
Best Regards, 
Vladimir Smutny 


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Introductory Techniques for 3-D Computer Vision by Emanuele Trucco, Alessandro Verri

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

cover Dark Basic Professional Edition - It is better to get this professional edition

cover This is a version of basic designed for building games, for example to rotate a cube you might do the following:
make object cube 1,100
for x=1 to 360
rotate object 1,x,x,0
next x

cover Game Programming with Darkbasic - book for above software

Can you help?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

progam

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2008 Martin John Baker - All rights reserved - privacy policy.