3
$\begingroup$

I have two different reference frames: xyz and x0y0z0. Both share the same origin, but there's a rotation between them.
My question is: How can I find the rotation matrix of Eulers angles from xyz to x0y0z0 given that I just know the coordinates of a vector in both reference frames?

Take the picture below, both frames are plotted and the vector from origin to point P1.
P1 and reference frames

The coordinates of $\vec {P1}$ are known in both frames: (P1x,P1y,P1z) and (P1x0,P1y0,P1z0). I know that the rotation of a frame to another can be done by rotating about $\psi$ rad in z axis, then $\theta$ rad in y axis and finally $\phi$ rad in x axis as:

$$ \begin{bmatrix} P1_{x_0} \\ P1_{y_0} \\ P1_{z_0} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos\phi & sin\phi \\ 0 & -sin\phi & cos\phi \end{bmatrix} \begin{bmatrix} cos\theta & 0 & -sin\theta \\ 0 & 1 & 0 \\ sin\theta & 0 & cos\theta \end{bmatrix} \begin{bmatrix} cos\psi & sin\psi & 0 \\ -sin\psi & cos\psi & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} P1_x \\ P1_y \\ P1_z \end{bmatrix} $$

But I don't know the other way back, finding the rotating matrix (or the Euler angles) from the known vectors.

I read about Rodrigues' formula in the form of: $$ \textbf{R} = \textbf{I}+sin(\alpha)[\hat n]_\times+(1-cos(\alpha))[\hat n]_\times^2 $$

I used $\hat n$ as the normalised unit vector of $\vec{P1}_{xyz} \times \vec{P1}_{x_0y_0z_0}$ and $\alpha$ as the angle between both as: $$ \alpha = arccos \biggl( \frac{\vec{P1}_{xyz}\cdot \vec{P1}_{x_0y_0z_0}}{|\vec{P1}_{xyz}||\vec{P1}_{x_0y_0z_0}|} \biggr) $$

I'm not pretty sure if I used correctly, but I got a rotation matrix that gives me the coordinates of a frame from the other one. But that matrix is not the same if I use the Euler angles besides the result of both is the same.

For instance, supose that I rotate the first frame 30° on z axis, then 30° in the y and then 30° in x. The rotation matrix is going to be: $$ R = \begin{bmatrix} 0.75 & 0.433 & -0.5 \\ -0.216 & 0.875 & 0.433 \\ 0.625 & -0.216 & 0.75 \end{bmatrix} $$

Now supose that my $\vec{P1}_{xyz}$ has the coord as $(2,2,2)$. Applying the matrix R, the vector $\vec{P1}_{x_0y_0z_0}$ is going to be $(1.36,2.18,2.31)$.

Calculating R from Rodrigues' formula, give me another matrix, $R_r$, which is different from $R$, but gives me the same results after applying it.

Is there a way to find one specific rotation matrix (in this case $R$) given one single vector? If not, how can I find a single rotation matrix from two or more known vectors in both frames?

$\endgroup$
  • $\begingroup$ If the coordinates are known for only one point, that's insufficient in determining the change of bases uniquely. Do you perhaps know both reference coordinates of other points as well? $\endgroup$ – Berci Jan 29 at 21:51
  • $\begingroup$ @Berci Yes, I can find another point, P2, known in the XoYoZo reference frame, but I just know that it has no y coordinates in frame XYZ, like (x,0,z) where x and z is not known. But vector P2 is going to be vector P1+another vector. $\endgroup$ – mbaggio Jan 29 at 23:23
  • $\begingroup$ would like to get your feedback on the answer provided: was that useful for you ? $\endgroup$ – G Cab Feb 8 at 21:21
1
$\begingroup$

You seem to be looking for the Direction Cosine Matrix (DCM):

Here is a good introduction: http://www.starlino.com/dcm_tutorial.html

Update:

The Rodrigues Formula (and DCM) is giving you the rotation along the shortest path from one frame to the other. You can visualize the path of rotation as an arc on the unit sphere from the one point on the sphere given by vector $P_1$ to other point on sphere given by vector $P_2$. Being both $P_1$ and $P_2$ unit vectors.

Of course there are several paths in the sphere connecting $P_1$ and $P_2$. Thus exist one different matrix per each corresponding path. For more details see the answer to this question:

https://stackoverflow.com/questions/37494882/is-the-rotation-matrix-unique-for-a-given-rotation

$\endgroup$
0
$\begingroup$

As already commented, there is not a unique way to reach to a given frame $\bf X'$, starting from another $\bf X$ with the same origin.
But then of course the resulting transfomation is the same.

Let's make some premises first.

  • We choose to work with "column" vectors and matrices that multiply them from the left.

  • A reference system is therefore expressed by the matrix which ordinately reports in the columns the components of the unitary vectors of the axes $x,y,z$.
    And speaking of orthogonal systems, the matrix will be orthogonal as well.

  • For two systems to be related by a proper rotation, they shall have the same chirality, i.e. "right hand rule", i.e. same sign of the determinant. Otherwise a reflection is also incuded.

  • The matrices $$ {\bf R}_{\,{\bf x}} (\alpha ) = \left( {\matrix{ 1 & 0 & 0 \cr 0 & {\cos \alpha } & { - \sin \alpha } \cr 0 & {\sin \alpha } & {\cos \alpha } \cr } } \right) \quad {\bf R}_{\,{\bf y}} (\beta ) = \left( {\matrix{ {\cos \beta } & 0 & {\sin \beta } \cr 0 & 1 & 0 \cr { - \sin \beta } & 0 & {\cos \beta } \cr } } \right) \quad {\bf R}_{\,{\bf z}} (\gamma ) = \left( {\matrix{{\cos \gamma } & { - \sin \gamma } & 0 \cr {\sin \gamma } & {\cos \gamma } & 0 \cr 0 & 0 & 1 \cr } } \right) $$ represent a rotation around the indicated axis, with the sign determined according to "right hand" rule.
    When applied to a (column) vector, expressed in a given reference system, they return the coordinates of the rotated vector also expressed in the given reference system.
    A rotation around an axis individuated by the vector ${\bf x'}$, which is obtained by the transformation ${\bf x'} = {\bf T}\;{\bf x}$, is given by $$ {\bf R}_{\,{\bf x}\,{\bf '}} = {\bf R}_{\,{\bf T}\,{\bf x}} = {\bf T}\,\,{\bf R}_{\,{\bf x}} \,{\bf T}^{\, - \,{\bf 1}} $$ Therefore two successive rotations expressed wrt the reference system will compose as $$ {\bf R}_{\,{\bf 2}} \,{\bf R}_{\,{\bf 1}} $$ i.e. leftwards.
    But if the second rotation is effected wrt to an axis in the rotated system, then the composition (expressed in the original reference) becomes: $$ \left( {{\bf R}_{\,{\bf 1}} \,{\bf R}_{\,{\bf 2}} \,{\bf R}_{\,{\bf 1}} ^{\, - \,{\bf 1}} } \right)\,{\bf R}_{\,{\bf 1}} = {\bf R}_{\,{\bf 1}} \,{\bf R}_{\,{\bf 2}} $$ i.e. rightward

That said, we come to your problem.

You cannot uniquely determine the rotation bringing one vector onto another: that will not allow to determine the component of the rotation around the vector itself.
We deal with the rotation bringing the orthogonal reference system defined by the matrix ${\bf X} (={\bf I})$ into the one defined by $\bf X'''$, and split it into three elementary components.
$$ \left\{ \matrix{ \left| {{\bf X'''}} \right| = 1\quad {\bf X'''}^{\, - \,{\bf 1}} = {\bf X'''}^{\,T} \hfill \cr {\bf X'''} = {\bf R}\;{\bf X} = {\bf R} = {\bf R'''}\;{\bf R''}\;{\bf R'} \hfill \cr} \right. $$

Among the various possible schemes, it seems that you want to proceed along the Euler angles "x-convention".

Rotaz_Eul_1

So we have:

  • a rotation $\alpha$ around $\bf z$, such as to bring ${\bf x}$ to $ {\bf n}$ $$ {\bf n} = {{{\bf z} \times {\bf z'''}} \over {\left| {{\bf z} \times {\bf z'''}} \right|}}\quad \to \quad \alpha \;:\;\;{\bf R}_{\,{\bf z}} (\alpha ) \left( {\matrix{ 1 \cr 0 \cr 0 \cr } } \right)\, = {\bf x'} = {\bf n} $$ If the cross-product is null we take $ {\bf n} = {\bf x}$.

  • a rotation $\beta$ around $\bf n = \bf x'$, such as to bring $ {\bf z' = \bf z} $ to $ {\bf z'' = \bf z'''}$;
    for what we saw above that will be $$ \beta :\;\;{\bf z''} = {\bf R}_{\,{\bf x}\,{\bf '}} (\beta )\;{\bf R}_{\,{\bf z}} (\alpha )\;\;{\bf z} = {\bf R}_{\,{\bf z}} (\alpha )\;{\bf R}_{\,{\bf x}} (\beta )\;{\bf z} = {\bf z'''} $$

  • a final rotation $\gamma$ around $\bf z''$, such as to bring $ {\bf x' = \bf x'' } $ to ${\bf x'''}$ or well ${\bf X''}$ to${\bf X'''}$ ;
    $$ \gamma :\;\;{\bf X'''} = {\bf R}_{\,{\bf z}\,'\,'} (\gamma )\;{\bf R}_{\,{\bf x}\,{\bf '}} (\beta )\;{\bf R}_{\,{\bf z}} (\alpha )\;\;{\bf X} = \;{\bf R}_{\,{\bf z}} (\alpha )\;{\bf R}_{\,{\bf x}} (\beta )\;{\bf R}_{\,{\bf z}} (\gamma )\;{\bf X} $$

Example:

given $$ {\bf X'''} = {1 \over 8}\left( {\matrix{ {\sqrt 6 } & { - \sqrt 6 } & 4 \cr {\left( {2 + \sqrt 3 } \right)\sqrt 2 } & {\left( {2 - \sqrt 3 } \right)\sqrt 2 } & { - 6} \cr {\left( {2\sqrt 3 - 1} \right)\sqrt 2 } & {\left( {2\sqrt 3 + 1} \right)\sqrt 2 } & {2\sqrt 3 } \cr } } \right) $$

  • $\bf n$ is $$ {\bf n} = \left[ {{1 \over 8}\left( {\matrix{ 0 \cr 0 \cr 1 \cr } } \right) \times \left( {\matrix{ 4 \cr { - 6} \cr {2\sqrt 3 } \cr } } \right)} \right]_{\,{\rm norm}} = {{\sqrt {13} } \over {13}}\left( {\matrix{ 3 \cr 2 \cr 0 \cr } } \right) $$

  • $\alpha$ therefore comes to be $$ \eqalign{ & {\bf R}_{\,{\bf z}} (\alpha )\left( {\matrix{ 1 \cr 0 \cr 0 \cr } } \right)\, = \left( {\matrix{ {\cos \alpha } \cr {\sin \alpha } \cr 0 \cr } } \right) = {\bf x'} = {\bf n} = {{\sqrt {13} } \over {13}}\left( {\matrix{ 3 \cr 2 \cr 0 \cr } } \right) = \quad \to \cr & \to \quad \alpha = \arctan (2/3) \cr} $$

  • while for $\beta$ we get $$ \eqalign{ & \beta :\;\;{\bf z''} = {\bf R}_{\,{\bf z}} (\alpha )\;{\bf R}_{\,{\bf x}} (\beta )\;{\bf z} = {\bf z'''} = \left( {\matrix{ {{2 \over {\sqrt {13} }}\sin \beta } \cr { - {3 \over {\sqrt {13} }}\sin \beta } \cr {\cos \beta } \cr } } \right) = {1 \over 4}\left( {\matrix{ 2 \cr { - 3} \cr {\sqrt 3 } \cr } } \right) \quad \to \cr & \to \quad \beta = \arctan \left( {\sqrt {13/3} } \right) \cr} $$

  • and finally $\gamma$ comes to be $$ \eqalign{ & \gamma :\;\;{\bf x'''} = \;{\bf R}_{\,{\bf z}} (\alpha )\;{\bf R}_{\,{\bf x}} (\beta )\;{\bf R}_{\,{\bf z}} (\gamma )\;{\bf x}\quad \to \cr & \to \quad \left\{ \matrix{ {{3\sqrt {13} } \over {13}}\cos \gamma - {{\sqrt 3 \sqrt {13} } \over {26}}\sin \gamma = {{\sqrt 3 \sqrt 2 } \over 4} \hfill \cr {{2\sqrt {13} } \over {13}}\cos \gamma + {{3\sqrt 3 \sqrt {13} } \over {52}}\sin \gamma = {{\sqrt 3 \sqrt 2 } \over 8} + {{\sqrt 2 } \over 4} \hfill \cr \quad \quad \quad \quad \quad \;{{\sqrt {13} } \over 4}\sin \gamma = {{\sqrt 3 \sqrt 2 } \over 4} - {{\sqrt 2 } \over 8} \hfill \cr} \right. \cr & \to \quad \gamma = \arctan \left( {\left( {2\sqrt 3 - 1} \right)/\left( {2\sqrt 3 + 1} \right)} \right) \cr} $$

You can check that with the above angles you correctly get $$ \eqalign{ & {\bf X'''} = \;{\bf R}_{\,{\bf z}} (\alpha )\;{\bf R}_{\,{\bf x}} (\beta )\;{\bf R}_{\,{\bf z}\,} (\gamma ) = \cr & = \;{\bf R}_{\,{\bf x}} (\pi /3)\;{\bf R}_{\,{\bf y}} (\pi /6)\;{\bf R}_{\,{\bf z}\,} (\pi /4) \cr} $$ where the second line is how the example was constructed (and is a demonstration that the composition is not unique).

$\endgroup$

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.