# Retrieving angle of rotation from transformation matrix

• Phong
In summary, the eigenvalues of a transformation matrix are in the identity matrix and the eigenvectors are the directions of rotation.
Phong
Hi!

How do I calculate the angle of rotation for each axis by a given 4x4 transformation matrix? The thing is that all values are a kind of mixed up in the matrix, so I cannot get discrete values to start calculating with anymore.

Thanks,

Phong

A four by four transformation matrix? Are you rotating in four dimensional space or is this a projective space?

First find the eigenvalues. A rotation matrix, in four dimensions may have two real and two complex-conjugate eigenvalues or two pairs of complex eigenvalues. If there are two real eigenvalues they must be either 1 or negative one. The eigenvectors corresponding to those eigenvalues give the axes of rotation. The complex eigenvalues will have modulus 1 and are of the form $cos(\theta)\pm i sin(\theta)$ where $\theta$ is the angle of rotation.

Two pairs of complex rotation give two simultaneous rotations in four space but are again of the form $cos(\theta)+ i sin(\theta)$. What those mean depends upon how you are writing vectors in four space.

If you are talking about a matrix representing a rotation matrix projectively, then you can renormalize to make the last row [0 0 0 1] and the last column $$\begin{bmatrix}0 \\ 0 \\ 0\\ 1\end{bmatrix}$$. The 3 by 3 matrix made up of the first three rows and columns will have one eigenvalue of 1 (the corresponding eigenvector gives the axis of rotation) and two complex conjugate eigenvalues of modulus 1. They will be of the form $cos(\theta)+ i sin(\theta)$ where $\theta$ is the angle of rotation.

Hello!

Thank you very much for your detailed reply. I must admit that I'm pretty new to transformation matrices and have not yet entirely understood the mathematical meaning of eigenvalues and eigenvectors although I try hard to understand everything I can read about it, but with some help I surely learn a lot faster.

I'm rotating in a projective three-dimensional space, that's why I use a 4x4 matrix.
To give a more specific example, I have a transformation matrix that is the following:

$$\begin{bmatrix}0.893 & 0.060 & -0.447 & 20 \\ -0.157 & 0.97 & -0.184 & 15 \\ -0.423 & -0.235 & -0.875 & 45 \\ 0 & 0 & 0 & 1 \end{bmatrix}$$

This transformation matrix should transform the object with a translation of 20 15 45 and a rotation of -15 25 -10 (xyz).

Now the eigenvalues. I don't know if I've understood the meaning of them correctly, but if yes the eigenvalues for this matrix should be in the identity matrix which is:

$$\begin{bmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}$$

So if I'm still on the right track, the eigenvectors, which are the axes of rotation, are simply
$$\left(1, 0, 0, 0)$$ for x
$$\left(0, 1, 0, 0)$$ for y
$$\left(0, 0, 1, 0)$$ for z

Am I still on the right track or am I totally and fatally wrong?

## 1. How do I find the angle of rotation from a transformation matrix?

To find the angle of rotation from a transformation matrix, you can use the atan2 function, which takes in the values of the rotation matrix and outputs the angle in radians. You can also use the acos function, which takes the trace of the rotation matrix and outputs the angle in radians.

## 2. Can I use a transformation matrix to calculate the angle of rotation in 3D space?

Yes, a transformation matrix can be used to calculate the angle of rotation in 3D space. However, you will need to use a different formula than the one used for 2D space. You can use the acos function to calculate the angle in 3D space by taking the trace of the rotation matrix.

## 3. Is it possible to retrieve the angle of rotation from a transformation matrix using only basic math?

Yes, it is possible to retrieve the angle of rotation from a transformation matrix using only basic math. As mentioned earlier, you can use the atan2 or acos functions to calculate the angle in radians. These functions use basic mathematical operations such as division and inverse trigonometric functions.

## 4. Can a transformation matrix have multiple angles of rotation?

No, a transformation matrix can only have one angle of rotation. This is because a transformation matrix represents a single transformation in space, and a single transformation can only have one angle of rotation. If you need to represent multiple rotations, you can use multiple transformation matrices.

## 5. Are there any built-in functions or libraries that can retrieve the angle of rotation from a transformation matrix?

Yes, there are built-in functions and libraries in many programming languages that can retrieve the angle of rotation from a transformation matrix. Some examples include the atan2 and acos functions in C++, the atan2 and acos methods in Java, and the atan2 and acos functions in Python's math library.

• Linear and Abstract Algebra
Replies
6
Views
1K
• Linear and Abstract Algebra
Replies
27
Views
3K
• Linear and Abstract Algebra
Replies
2
Views
2K
• Linear and Abstract Algebra
Replies
4
Views
1K
• Mechanical Engineering
Replies
3
Views
588
• Mechanics
Replies
12
Views
1K
• Linear and Abstract Algebra
Replies
4
Views
2K
• Linear and Abstract Algebra
Replies
2
Views
1K
• Linear and Abstract Algebra
Replies
5
Views
2K
• Linear and Abstract Algebra
Replies
3
Views
2K