I am trying to learn more about matrices. If I have a 4×4 matrice such as :
0.005 0.978 -0.20 60.62
-0.98 -0.027 0.15 -18.942
-0.15 0.20 0.96 -287.13
0 0 0 1
Which part of the matrix tells me the rotation that is applied to an object ? I know that column 4 is the position of the object and suspect row 1,2 and 3 are the x,y and z rotation ?
Thanks in advance.
The first three columns are directional vectors in the x, y, z directions, possibly including scaling of the object. If you imagine a cube, the first column’s vector points in the direction of the positive-x-face of the cube, the second in the direction of the positive-y-face and the third in the direction of the positive-z-face.
Note that when object-scaling was applied to the matrix (which doesn’t appear to be the case in your example), those direction vectors are not normalized.
But this isn’t “rotation” in the euler-angle or quaternion-rotation sense. In fact calculating any angles from this matrix is pretty tricky.
Here are some links that explain how to do it, but this comes with a lot of problems and you should avoid it if it’s not absolutely necessary:
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm
http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm