0
$\begingroup$

I have a rotation matrix $R$ of size ($d\times d$) - meaning, this is an orthogonal matrix with $det(R)=1$.

I want to calculate the axis of rotation for this matrix and the angle of rotation around this axis.

It is known that the axis of rotation is a $(d-2)$ dimensional hyperplane that passes through the origin. Which means that the axis hyperplane is represented by (d-2) unit vectors (the point is already known which is the origin).

Anyone knows how to find both the axis and the angle of rotation. I searched the internet and didn't find anything (except for the specific case of d=3).

Thanks.

$\endgroup$
  • 2
    $\begingroup$ Once $d>3$, then it’s possible to have simultaneous independent rotations, so I don’t think that “angle” and “axis” are well-defined concepts except in some special cases. $\endgroup$ – amd Oct 30 '17 at 20:04
  • $\begingroup$ Can you tell me what you mean by "simultaneous independent rotations"? Anyway, as I said bellow (in a comment to Bastiaan), I thought the angle+axis are unique for a rotation matrix. I also wrote what I'm trying to do, so maybe you can suggest a better way. Thanks! $\endgroup$ – David Oct 31 '17 at 10:58
  • 1
    $\begingroup$ Simple example: $\tiny{\begin{bmatrix}R_1 & 0\\0&R_2\end{bmatrix}}$, where $R_1$ and $R_2$ are $2\times2$ rotation matrices. $\endgroup$ – amd Oct 31 '17 at 19:49
  • 1
    $\begingroup$ It illustrates what you asked me about. The rotation in the $x_1$-$x_2$ plane that has no effect whatsoever on the $x_3$-$x_4$ plane, which is itself being rotated. What you you consider the “axis” for this combination? $\endgroup$ – amd Nov 1 '17 at 17:42
  • 1
    $\begingroup$ Not that I can see, but you’re welcome to try to find one. That any combination of rotations can be expressed as a single rotation about some axis is, AFAIK, unique to 3-D. I suppose that one could define the “axis” of a rotation in higher dimensions as the eigenspace of $1$, but, particularly in even-dimensional spaces, $1$ might not even be an eigenvalue. $\endgroup$ – amd Nov 1 '17 at 22:58
1
$\begingroup$

First of all, you'd have to make sure that the matrix actually is a rotation. When all eigenvalues have $|\lambda_k| = 1$, the matrix won't shear or distort. Then, $|\det A|=1$, too. If $\det A=1$, the matrix keeps handiness (that is, won't mirror), too. Then you could call the matrix a rotation. You'd still have the problem that there'd not need to be a single "axis of rotation".

If you do an eigenvalue decomposition, rotations in the ordinary sense (mapping real vectors to real vectors) will show up as eigenvalues $\lambda_k=1$ (mirror-rotations as $\lambda_k=-1$), associated to a real eigenvector of length $1$ that shows the rotation axis.

In the three-dimensional case, plainly speaking, there's always exactly one of these. The other two degrees of freedom will have complex eigenvalues and complex coordinates.

If there are more of three dimensions, we could still have rotation about an axis with a specific angle. However, this is a special case. You could as well have more than one axis. Still, I'd recommend the following path, if you "just" want to solve the problem computationally:

  • Do an eigenvalue decomposition
  • Make sure that $\hspace{5px}\forall k \hspace{10px} |\lambda_k| \approx 1$. It not, fail with message "not a rotation" or deal with it some other way.
  • Find the eigenvalues $\lambda_k = 1$ - specifically not $|\lambda_k| = 1$.
  • The associated eigenvectors give the rotation axes.
  • If $\lambda_k = -1$ actually, the image is flipped (mirrored) in the direction of this axis

Additional reading:

https://en.wikipedia.org/wiki/Rotation_matrix https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation

$\endgroup$
  • $\begingroup$ Thank you for your answer. I will try it. However, I did think that there's a single axis and angle for each $d-dimensional$ rotation matrix. Since it's not unique maybe there's no point doing so. I'll tell you my intention maybe you can suggest some better way. $\endgroup$ – David Oct 31 '17 at 10:55
  • $\begingroup$ I want to be able to compare between two rotation matrices. I want to know how much one rotation matrix is close to the other rotation matrix. my goal was to calculate axis+angle for each rotation matrix and then compare between them. for example for $3D$ I get a single axis vector and an angle. I can compare between the angles by subtracting them. and I can compare between the vectors by calculating the angle between them (dot product). If I subtract between two rotation matrices I don't know how to use the result in order to determine how much they close to each other. $\endgroup$ – David Oct 31 '17 at 10:55
  • $\begingroup$ Having a single rotation axis is a special case. However, in three dimensions, this is the only possibility. Stop by here: en.wikipedia.org/wiki/Axis%E2%80%93angle_representation en.wikipedia.org/wiki/Rodrigues%27_rotation_formula en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions $\endgroup$ – user222134 Oct 31 '17 at 12:38
  • $\begingroup$ What do you suggest if there are no real eigenvalues/eigenvectors? $\endgroup$ – amd Oct 31 '17 at 19:51
  • $\begingroup$ If there are none at all, I'd not call the transformation a "rotation". $\endgroup$ – user222134 Nov 2 '17 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.