1
$\begingroup$

I'm working with rotations in n dimensions. I represent these rotations as a sequence of $(n^2 - n)/2$ angles, one for each pair of axes, in a fixed order. I can easily compute a rotation matrix from this, by generating the Givens matrix for each angle, and multiplying these matrices.

The problem is doing it the other way around. Given an orthogonal matrix, how can I retrieve the angles in the right order? I'm using an evolutionary algorithm at the moment, which works reasonably well, but is very slow. It would be good if there were a fast method for calculating an exact solution. Unfortunately, most things I find are limited to the 3d case.

My linear algebra is limited to the very practical. I'm willing to learn, of course, but I need to know where to look first.

1 Answers 1

0

I assume your orthogonal matrix $R$ has determinant 1, so it is possible to write it as a product of rotations. Let $e_j$, $j=1\ldots n$, be the standard unit vectors in ${\mathbb R}^n$.

Here's one possible strategy. Take a rotation $R_{1,n}$ in coordinates $1$ and $n$ such that $(R_{1,n} R^{-1} e_n)_1 = 0$, then $R_{2,n}$ in coordinates $2$ and $n$ such that $(R_{2,n} R_{1,n} R^{-1} e_n)_2 = 0$ (noting that you'll still have $(R_{2,n} R_{1,n} R^{-1} e_n)_1 = 0$, and so on until $(R_{n-1,n} \ldots R_{1,n} R^{-1} e_n)_i = 0$ for $i=1,2,\ldots,n-1$. Then $(R_{n-1,n} \ldots R_{1,n} R^{-1} e_n)_n$ must be $\pm 1$. If it's $-1$, change $R_{n-1,n}$ by angle $\pi$ to make it $+1$. Note that, by orthogonality, $R_{n-1,n} \ldots R_{1,n} R^{-1} e_j)_n = 0$ for all $j < n$. Proceed in the same way on the $n-1$ component: $R_{n-2,n-1} \ldots R_{1,n-1} R_{n-1,n} \ldots R_{1,n} R^{-1} e_j = e_j$ for $j=n-1$ and $j=n$. Continue iterating down to $j=2$, obtaining finally $R_{1,2} R{2,3} R_{1,3} \ldots R_{1,n} R^{-1} e_j = e_j$ for $j = 2,3, \ldots, n$. Since, by assumption, the determinant is $1$, this will also be true for $j=1$. Thus $R_{1,2} R_{2,3} R_{1,3} \ldots R_{1,n} R^{-1} = I$, i.e. $R_{1,2} R_{2,3} R_{1,3} \ldots R_{1,n} = R$.

  • 0
    In case anybody else is interested, here is an implementation of this algorithm: https://github.com/pbloem/Lilian/blob/master/Lilian/src/main/java/org/lilian/data/real/Rotation.java#L2332013-04-05