Q:

Concatenating two Rotation-Matrices

I have two $2\mathrm{D}$-planes in $3\mathrm{D}$-space with orientation parameters expressed as rotation $R_1$ and translation $T_1$ and rotation $R_2$ and translation $T_2$ with respect to some arbitrary origin. Translation is stored as a $3 \times 1$ matrix and Rotation is stored as a $3 \times 3$ matrix.
I want to transform these parameters to change the origin to the center of the first plane and express rotation $R_2$ and translation $T_2$ for the second plane relative to the first plane. Well, for the translation this seems easy: $T_2 - T_1$. But for rotation I'm not sure. Maybe transposing the $R_1$ matrix and concatenating with the $R_2$ matrix is the correct approach?
Can anybody point me to a solution? I guess this should be a fairly well known problem.

A:

If I understand correctly, the two transforms are $x_i=R_ix+T_i$ and you're looking for a transform such that $x_2=Rx_1+T$. This can be done by solving the first equation for $x_1$, which yields $x=R_1^{-1}(x_1-T_1)=R_1^\top(x_1-T_1)$ (since $R_1$ is orthogonal) and substituting into the second equation to obtain $x_2=R_2R_1^\top(x_1-T_1)+T_2$, or $x_2=R_2R_1^\top x_1+(T_2-R_2R_1^\top T_1)$, so the parameters are $R=R_2R_1^\top$ and $T=T_2-R_2R_1^\top T_1$.

