   converting 3x3 matrix to 3 axis and angle?
  Iv looked around on google, and im starting to wonder if its possible..Is it possible to convert a 3 by 3 matrix to and from an axis and angle representation? For example if my matrix was representing the y axis rotated pi/4 radians, the angle axis repesentation would be:axis(0,1,0)angle(pi/4)I know it can be done with a single axis easily (and i already have functions to do that), but how can it be done using 3 axis?I dont know much about quaternions, but is this angle axis representation the same as a quaternion? if it is then ill just look that up instead   
  You're probably using the wrong search terms.I typed "matrix to axis angle" into google and got thisA quaternion is not the same as the axis-angle representation.  Unit-quaternion rotation is quite complicated to explain (to do with 4-dimension spheres), quaternions are useful because its cheaper to perform certain operations with them, such as interpolation than it is with a matrix for example.   ;Quote:I know it can be done with a single axis easily (and i already have functions to do that), but how can it be done using 3 axis?Just to help clarify things a bit, what do you mean by 'converting a matrix to 3 axis and angle'?Can you give an example?   ;  May I ask why you want to do this in the first place?There is really no way to do this in a general sense with any reliability. Rotations are encoded in the matrix and are almost impossible to retrieve. If you want this data in order to do something like glRotate3f(...), then you need to buff up your knowledge of whatever graphics API you are using.If you have a 3x3 rotation matrix, you can easily rotate the model view matrix of your scene by that matrix using the function glMatrixMult(float*), where the parameter is a 16 entry array of values representing a 4x4 transformation matrix given by the following format:[ R.x.x R.y.x R.z.x 0 ][ R.x.y R.y.y R.z.y 0 ][ R.x.z R.y.z R.z.z 0 ][ 0001 ]where R is the rotation matrix, R.x, R.y, R.z are column vectors of that matrix.   ;Quote:Original post by jykQuote:I know it can be done with a single axis easily (and i already have functions to do that), but how can it be done using 3 axis?Just to help clarify things a bit, what do you mean by 'converting a matrix to 3 axis and angle'?I think he might mean 3-axis as in 3D axis, but I'm not sure.   ;  yes, i mean 3-axis / angleIm not really sure of the correct terminology for this but 3-axis / angle is basically what i needdmatter, thanks for the link, that basically tells me just what i neededThanks   ;  Once again, may I ask why you need this information?I highly recommend avoiding any sort of euler/axis angle representations of rotations. It will only result in unreliable code that doesn't always work. It will be subject to problems like gimbal lock, and plus it is a lot slower than just accepting the matrix as a total representation of any rotation.The rotation matrix is a highly useful construct and should be taken advantage of whenever possible. Quaternions are also a valid solution with a few specific advantages, but they are hard to visualize and understand and require slightly more calculations, because in order to rotate a point through a quaternion, one must first convert it to a 3x3 rotation matrix. This is why I just use 3x3 rotation matrices instead.The key point is that any sort of axis angle representation of rotations has degenerate cases which will either break your code or will have to be detected and handled individually. Ironically, once you get an axis angle representation, it will more than likely be converted back into rotation matrix form in whatever application you need it for. This is because rotation matrices are extrememly useful and easily and quickly handle rotations.   ;  Do you mean this (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html)?  ( xx(1-c)+cxy(1-c)-zs  xz(1-c)+ys 0  )  |    |  | yx(1-c)+zsyy(1-c)+c   yz(1-c)-xs 0  |  | xz(1-c)-ysyz(1-c)+xs  zz(1-c)+c 0  |  |    |  ( 00 0 1  )  Wherec = cos(angle),s = sine(angle), and ||( x,y,z )|| = 1The x, y, and z are the axis.EDIT: Though that is from x/y/z/angle to matrix, not sure if you want the other way around.   ;  There is no specific reason why i wanted 3-axis and angle representation; I was working on my math library and I thought it would just feel more complete if I had this representation avaliable. I totaly agree that matricies are a better way to store rotations, and thats how I do store rotations already.Its just another thing that might make certain things easier, for example when setting the rotation of a rigid body. If i wanted my rigid body rotated 45 degrees on x and y, its easier to pass an axis and and angle to the constructor than it is to pass a matrix. Actually, I plan on making a constructor in the matrix class that takes axis angle as parametersAlso i think that axis angle thing on the opengl page is basically what im after (though thats not how i plan to pass rotations to opengl)   ;Quote:Original post by GumgoDo you mean this (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html)?  ( xx(1-c)+cxy(1-c)-zs  xz(1-c)+ys 0  )  |    |  | yx(1-c)+zsyy(1-c)+c   yz(1-c)-xs 0  |  | xz(1-c)-ysyz(1-c)+xs  zz(1-c)+c 0  |  |    |  ( 00 0 1  )  Wherec = cos(angle),s = sine(angle), and ||( x,y,z )|| = 1The x, y, and z are the axis.EDIT: Though that is from x/y/z/angle to matrix, not sure if you want the other way around.Yes, that's an 'axis-angle' rotation matrix.I think your use of the term '3-axis' may still be causing some confusion. If you indeed mean a '3d axis', you can drop the '3' and just use the term 'axis'. This will be less confusing, as the term 'axis-angle' is common and will be better understood.Aressera might have been talking about something else, but just to be clear, the axis-angle representation doesn't suffer from any degeneracies or singularities to speak of. However, as noted, it isn't the easiest representation to work with.   