I have a 3d object which is free to rotate along x,y and z axis and it is then saved as a transform matrix. In a case where the sequence of rotation is not known and the object is rotated for more than 3 times (eg :-if i rotate the object x-60degress, y-30 degrees, z-45 degrees then again x->30 degrees), is it possible to extract the angles rotated from the transform matrix?.I know that it is possible to get angles if the sequence of rotation is known, but if I have only the final transform matrix with me and nothing else, is it possible to get the angles rotated(x,y,and z) from the transform matrix ?
0
votes
Yes it is possible. You can find the help at programming-technique.blogspot.com/2012/03/…
– user1481317
But it does not show how to get the angle. I need to all three angles
– Vinod Paul
what do you mean it can be rotated in any order? Normally changing the order of rotation changes the result... Do you need it to be in xyz notation or can it be angle and direction?
– Hammer
also are you using a specific library for matrix math already? OpenCV for instance already has a function to do this for you.
– Hammer
By order i meant, for example the if user rotates the 3D object 45 deg along x axis then 45 along y and at last 60 along z axis and in that case the order is known and it is x->y->z. The angle can be retrieved back from the transform matrix for the above matrix. But my case is different the order of rotation is not known 'a priori', and it is the user's wish in which direction it should be rotated. And for different order the output matrix changes(the final transformed matrix). My Qn is, is it possible to retrieve the angle rotated from the matrix for such a condition
– Vinod Paul
1 Answers
2
votes
Euler angle conversion is a pretty well known topic. Just normalize the matrix orientation vectors and then use something like this c source code.
The matrix is the current state of things it has no knowledge of what the transformation has been in the past. It does not know how the matrix was built. You can just take the matrix into and decompose it into any pieces you like, as long as:
- The data do not overlap. For example:Two X turns after each other is indistinguishable form each other (no way to know if its 1 2 or three different rotations summed).
- The sequence order is known
- A decomposition can be built out of the data (for example scale can be measured)