# Maths - Conversion Matrix to Axis Angle

 By: Vladimir Smutny - smutny Matrix to Axis Angle slight correction   2006-05-10 11:30 Dear Mr. Baker,  I believe that the Java(?) code on the page  https://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