Finding a specific Rotation matrix given a known vector












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 & cosphi & sinphi \
0 & -sinphi & cosphi
end{bmatrix}
begin{bmatrix}
costheta & 0 & -sintheta \
0 & 1 & 0 \
sintheta & 0 & costheta
end{bmatrix}
begin{bmatrix}
cospsi & sinpsi & 0 \
-sinpsi & cospsi & 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?










share|cite|improve this question











$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
















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 & cosphi & sinphi \
0 & -sinphi & cosphi
end{bmatrix}
begin{bmatrix}
costheta & 0 & -sintheta \
0 & 1 & 0 \
sintheta & 0 & costheta
end{bmatrix}
begin{bmatrix}
cospsi & sinpsi & 0 \
-sinpsi & cospsi & 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?










share|cite|improve this question











$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














3












3








3


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 & cosphi & sinphi \
0 & -sinphi & cosphi
end{bmatrix}
begin{bmatrix}
costheta & 0 & -sintheta \
0 & 1 & 0 \
sintheta & 0 & costheta
end{bmatrix}
begin{bmatrix}
cospsi & sinpsi & 0 \
-sinpsi & cospsi & 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?










share|cite|improve this question











$endgroup$




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 & cosphi & sinphi \
0 & -sinphi & cosphi
end{bmatrix}
begin{bmatrix}
costheta & 0 & -sintheta \
0 & 1 & 0 \
sintheta & 0 & costheta
end{bmatrix}
begin{bmatrix}
cospsi & sinpsi & 0 \
-sinpsi & cospsi & 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?







rotations






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 30 at 0:01









J. W. Tanner

4,2361320




4,2361320










asked Jan 29 at 21:19









mbaggiombaggio

161




161












  • $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


















  • $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
















$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$
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$
@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




$begingroup$
would like to get your feedback on the answer provided: was that useful for you ?
$endgroup$
– G Cab
Feb 8 at 21:21










2 Answers
2






active

oldest

votes


















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






share|cite|improve this answer











$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| = 1quad {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( {2sqrt 3 - 1} right)sqrt 2 } & {left( {2sqrt 3 + 1} right)sqrt 2 } & {2sqrt 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 {2sqrt 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{
      {{3sqrt {13} } over {13}}cos gamma - {{sqrt 3 sqrt {13} } over {26}}sin gamma = {{sqrt 3 sqrt 2 } over 4} hfill cr
      {{2sqrt {13} } over {13}}cos gamma + {{3sqrt 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( {2sqrt 3 - 1} right)/left( {2sqrt 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).






    share|cite|improve this answer









    $endgroup$














      Your Answer





      StackExchange.ifUsing("editor", function () {
      return StackExchange.using("mathjaxEditing", function () {
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      });
      });
      }, "mathjax-editing");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "69"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3092738%2ffinding-a-specific-rotation-matrix-given-a-known-vector%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      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






      share|cite|improve this answer











      $endgroup$


















        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






        share|cite|improve this answer











        $endgroup$
















          1












          1








          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






          share|cite|improve this answer











          $endgroup$



          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







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Jan 30 at 12:39

























          answered Jan 30 at 11:51









          Mauricio Cele Lopez BelonMauricio Cele Lopez Belon

          839411




          839411























              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| = 1quad {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( {2sqrt 3 - 1} right)sqrt 2 } & {left( {2sqrt 3 + 1} right)sqrt 2 } & {2sqrt 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 {2sqrt 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{
                {{3sqrt {13} } over {13}}cos gamma - {{sqrt 3 sqrt {13} } over {26}}sin gamma = {{sqrt 3 sqrt 2 } over 4} hfill cr
                {{2sqrt {13} } over {13}}cos gamma + {{3sqrt 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( {2sqrt 3 - 1} right)/left( {2sqrt 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).






              share|cite|improve this answer









              $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| = 1quad {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( {2sqrt 3 - 1} right)sqrt 2 } & {left( {2sqrt 3 + 1} right)sqrt 2 } & {2sqrt 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 {2sqrt 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{
                  {{3sqrt {13} } over {13}}cos gamma - {{sqrt 3 sqrt {13} } over {26}}sin gamma = {{sqrt 3 sqrt 2 } over 4} hfill cr
                  {{2sqrt {13} } over {13}}cos gamma + {{3sqrt 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( {2sqrt 3 - 1} right)/left( {2sqrt 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).






                share|cite|improve this answer









                $endgroup$
















                  0












                  0








                  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| = 1quad {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( {2sqrt 3 - 1} right)sqrt 2 } & {left( {2sqrt 3 + 1} right)sqrt 2 } & {2sqrt 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 {2sqrt 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{
                    {{3sqrt {13} } over {13}}cos gamma - {{sqrt 3 sqrt {13} } over {26}}sin gamma = {{sqrt 3 sqrt 2 } over 4} hfill cr
                    {{2sqrt {13} } over {13}}cos gamma + {{3sqrt 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( {2sqrt 3 - 1} right)/left( {2sqrt 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).






                  share|cite|improve this answer









                  $endgroup$



                  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| = 1quad {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( {2sqrt 3 - 1} right)sqrt 2 } & {left( {2sqrt 3 + 1} right)sqrt 2 } & {2sqrt 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 {2sqrt 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{
                    {{3sqrt {13} } over {13}}cos gamma - {{sqrt 3 sqrt {13} } over {26}}sin gamma = {{sqrt 3 sqrt 2 } over 4} hfill cr
                    {{2sqrt {13} } over {13}}cos gamma + {{3sqrt 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( {2sqrt 3 - 1} right)/left( {2sqrt 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).







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Feb 2 at 0:02









                  G CabG Cab

                  20.4k31341




                  20.4k31341






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Mathematics Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3092738%2ffinding-a-specific-rotation-matrix-given-a-known-vector%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith