Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an affine transform from $R^3$ to $R^3.$ It is described as Rotation about Z axis, rotation about X axis, a translation, rotation about Z axis, and lastly a scaling (same in all 3 dimensions).

It is therefore a similarity. Now, I would like to represent this affine transform as the following composition instead: Translation, rotation about X, rotation about Y, rotation about Z, and lastly scale.

Thus, given a similarity, how do I find the 3 angles, the translation, and the scale? I know this representation is not unique, but any one should do.

If it helps, I have access to all parameters in the first representation.

share|cite|improve this question
up vote 2 down vote accepted

The given similarity is of the form $$S:\quad x\mapsto Ax+b\ ,$$ where the matrix $A$ and the vector $b$ are known to us. The scaling factor $\rho>0$ (if not given in advance) and the rotational part $T$ of $S$ can be read off from the matrix $A$: If $a_{\cdot1}$ is the first column of $A$ then $\rho=|a_{\cdot1}|$. The matrix $$T:={1\over\rho} A$$ is orthogonal and describes the rotational part of $S$. Now we should represent $T$ as a product of three matrices in the following way: $$T=\left[\matrix{c_3&-s_3&\cr s_3&c_3&\cr&&1\cr}\right]\left[\matrix{c_2&&s_2\cr &1&\cr -s_2&&c_2\cr}\right]\left[\matrix{1&&\cr &c_1&-s_1\cr&s_1&c_1\cr}\right]=:P\ .$$ Here $c_i=\cos\phi_i$, $s_i=\sin\phi_i$. If you compute the product $P$ of the three rotation matrices you will see that it is not a hopeless task to find the $c_i$ and $s_i$; e.g., one has $p_{31}=-s_2$.

I assume now that you have found three admissible angles $\phi_i$. It remains to find a translation vector $c$ such that $$Ax+b\ \equiv \rho\bigl(T(x+c)\bigr)\ .$$ As $A=\rho T\ $ it is enough to take care of the point $x=0$. This leads to the equation $b=\rho\ Tc$ which can easily be solved for $c\> $: Since $T$ is an orthogonal matrix one gets $$c\ = {1\over\rho}\ T'b\ .$$

share|cite|improve this answer
That worked like a charm! – Per Alexandersson Aug 28 '11 at 8:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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