Combining two rotations

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I'm working on a project, where I have to perform rotations of a point which is on the surface of a sphere of radius 1, around the center of the sphere.



In order to do so, I have a function, let's call it $U$, that is parametrized by 3 angles (real numbers) $theta$, $phi$ and $lambda$, and that performs the following operations on its input: it performs a rotation on $z$ of $phi$ radians, then a rotation over $y$ of $theta$ radians, and finally a last rotation, again on $z$, of $lambda$ radians.



In short: $U(theta, phi, lambda) := R_z(phi) R_y(theta) R_z(lambda)$.



Now here is my question: if I successively apply U with angles $theta_1, phi_1, lambda_1$, and then with other angles $theta_2, phi_2, lambda_2$, is there a method to find which angles $theta, phi, lambda$ would have led to the same rotation in only one application of the function, and if so, how ?







share|cite|improve this question



















  • By $R_z(phi)$ do you mean $R_x(phi)$?
    – Arnaud Mortier
    11 hours ago










  • Yes, you can find a solution, but that might not be unique.
    – Andrei
    11 hours ago










  • Arnaud Mortier: No, it really is $R_z(phi)$. I am taking that $U$ function from a paper, and have to stick with it.
    – 4rzael
    9 hours ago










  • And @Andrei: The non-uniqueness of the result is not a problem (a deterministic solution to the problem would be preferable, in this case, though)
    – 4rzael
    9 hours ago














up vote
2
down vote

favorite












I'm working on a project, where I have to perform rotations of a point which is on the surface of a sphere of radius 1, around the center of the sphere.



In order to do so, I have a function, let's call it $U$, that is parametrized by 3 angles (real numbers) $theta$, $phi$ and $lambda$, and that performs the following operations on its input: it performs a rotation on $z$ of $phi$ radians, then a rotation over $y$ of $theta$ radians, and finally a last rotation, again on $z$, of $lambda$ radians.



In short: $U(theta, phi, lambda) := R_z(phi) R_y(theta) R_z(lambda)$.



Now here is my question: if I successively apply U with angles $theta_1, phi_1, lambda_1$, and then with other angles $theta_2, phi_2, lambda_2$, is there a method to find which angles $theta, phi, lambda$ would have led to the same rotation in only one application of the function, and if so, how ?







share|cite|improve this question



















  • By $R_z(phi)$ do you mean $R_x(phi)$?
    – Arnaud Mortier
    11 hours ago










  • Yes, you can find a solution, but that might not be unique.
    – Andrei
    11 hours ago










  • Arnaud Mortier: No, it really is $R_z(phi)$. I am taking that $U$ function from a paper, and have to stick with it.
    – 4rzael
    9 hours ago










  • And @Andrei: The non-uniqueness of the result is not a problem (a deterministic solution to the problem would be preferable, in this case, though)
    – 4rzael
    9 hours ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm working on a project, where I have to perform rotations of a point which is on the surface of a sphere of radius 1, around the center of the sphere.



In order to do so, I have a function, let's call it $U$, that is parametrized by 3 angles (real numbers) $theta$, $phi$ and $lambda$, and that performs the following operations on its input: it performs a rotation on $z$ of $phi$ radians, then a rotation over $y$ of $theta$ radians, and finally a last rotation, again on $z$, of $lambda$ radians.



In short: $U(theta, phi, lambda) := R_z(phi) R_y(theta) R_z(lambda)$.



Now here is my question: if I successively apply U with angles $theta_1, phi_1, lambda_1$, and then with other angles $theta_2, phi_2, lambda_2$, is there a method to find which angles $theta, phi, lambda$ would have led to the same rotation in only one application of the function, and if so, how ?







share|cite|improve this question











I'm working on a project, where I have to perform rotations of a point which is on the surface of a sphere of radius 1, around the center of the sphere.



In order to do so, I have a function, let's call it $U$, that is parametrized by 3 angles (real numbers) $theta$, $phi$ and $lambda$, and that performs the following operations on its input: it performs a rotation on $z$ of $phi$ radians, then a rotation over $y$ of $theta$ radians, and finally a last rotation, again on $z$, of $lambda$ radians.



In short: $U(theta, phi, lambda) := R_z(phi) R_y(theta) R_z(lambda)$.



Now here is my question: if I successively apply U with angles $theta_1, phi_1, lambda_1$, and then with other angles $theta_2, phi_2, lambda_2$, is there a method to find which angles $theta, phi, lambda$ would have led to the same rotation in only one application of the function, and if so, how ?









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









asked 11 hours ago









4rzael

1112




1112











  • By $R_z(phi)$ do you mean $R_x(phi)$?
    – Arnaud Mortier
    11 hours ago










  • Yes, you can find a solution, but that might not be unique.
    – Andrei
    11 hours ago










  • Arnaud Mortier: No, it really is $R_z(phi)$. I am taking that $U$ function from a paper, and have to stick with it.
    – 4rzael
    9 hours ago










  • And @Andrei: The non-uniqueness of the result is not a problem (a deterministic solution to the problem would be preferable, in this case, though)
    – 4rzael
    9 hours ago
















  • By $R_z(phi)$ do you mean $R_x(phi)$?
    – Arnaud Mortier
    11 hours ago










  • Yes, you can find a solution, but that might not be unique.
    – Andrei
    11 hours ago










  • Arnaud Mortier: No, it really is $R_z(phi)$. I am taking that $U$ function from a paper, and have to stick with it.
    – 4rzael
    9 hours ago










  • And @Andrei: The non-uniqueness of the result is not a problem (a deterministic solution to the problem would be preferable, in this case, though)
    – 4rzael
    9 hours ago















By $R_z(phi)$ do you mean $R_x(phi)$?
– Arnaud Mortier
11 hours ago




By $R_z(phi)$ do you mean $R_x(phi)$?
– Arnaud Mortier
11 hours ago












Yes, you can find a solution, but that might not be unique.
– Andrei
11 hours ago




Yes, you can find a solution, but that might not be unique.
– Andrei
11 hours ago












Arnaud Mortier: No, it really is $R_z(phi)$. I am taking that $U$ function from a paper, and have to stick with it.
– 4rzael
9 hours ago




Arnaud Mortier: No, it really is $R_z(phi)$. I am taking that $U$ function from a paper, and have to stick with it.
– 4rzael
9 hours ago












And @Andrei: The non-uniqueness of the result is not a problem (a deterministic solution to the problem would be preferable, in this case, though)
– 4rzael
9 hours ago




And @Andrei: The non-uniqueness of the result is not a problem (a deterministic solution to the problem would be preferable, in this case, though)
– 4rzael
9 hours ago










3 Answers
3






active

oldest

votes

















up vote
2
down vote













You can express rotations as matrices. Their combination is found by matrix multiplication.



In your case




it performs a rotation on $z$ of $phi$ radians, then a rotation over
$y$ of $theta$ radians, and finally a last rotation, again on $z$, of
$lambda$ radians.




we have:



beginalign
U
&= R_z(lambda) , R_y(theta) , R_z(phi) \
&=
beginpmatrix
coslambda & -sinlambda & 0 \
sinlambda & coslambda & 0 \
0 & 0 & 1
endpmatrix
beginpmatrix
costheta & 0 & -sintheta \
0 & 1 & 0 \
sintheta & 0 & costheta
endpmatrix
beginpmatrix
cosphi & -sinphi & 0 \
sinphi & cosphi & 0 \
0 & 0 & 1
endpmatrix
\
&=
beginpmatrix
coslambda & -sinlambda & 0 \
sinlambda & coslambda & 0 \
0 & 0 & 1
endpmatrix
beginpmatrix
costheta cosphi & -costheta sinphi & -sintheta \
sinphi & cosphi & 0 \
sintheta cosphi & -sintheta sinphi & costheta
endpmatrix
\
&=
beginpmatrix
coslambda costheta cosphi - sinlambda sinphi &
-coslambda costheta sinphi - sinlambda cosphi &
-coslambda sintheta \
sinlambda costheta cosphi + coslambda sinphi &
-sinlambda costheta sinphi + coslambda cosphi &
-sinlambda sintheta \
sintheta cosphi &
-sintheta sinphi &
costheta
endpmatrix
endalign
This results in a single $3 times 3$ matrix.



If you have two of those transformations $U_1$ and $U_2$ then the composition is given by the matrix product
$$
U_2 U_1
$$
One would have to calculate the resulting matrices and then check if it is possible to easily read the angles from the result.






share|cite|improve this answer























  • I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
    – 4rzael
    9 hours ago










  • You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
    – mvw
    9 hours ago










  • Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
    – Andrei
    9 hours ago










  • @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
    – mvw
    9 hours ago











  • @mvw That's exactly what I was looking at :)
    – Andrei
    9 hours ago

















up vote
0
down vote













A lot of details about this subject are in the Wikipedia article Euler angles. As an alternative, you can use
quaternions as in the Wikipedia article Quaternion and spatial rotations and just multiply two or more quaternions.






share|cite|improve this answer




























    up vote
    0
    down vote













    Start from the rotation matrix in terms of Euler angles. $$R(phi,theta,lambda)=beginpmatrixR_11& R_12 &R_13\R_21& R_22 &R_23\R_31& R_32 &R_33endpmatrix$$



    First calculate the inner most angle. If $R_31$ and $R_32$ are both zero, use $lambda=0$. Otherwise $$tanlambda=fracR_32-R_31$$ You can use the $arctan2$ function
    $$lambda=arctan2 (R_32,-R_31)$$



    Now calculate $$R'(phi,theta)=R(phi,theta,lambda)R^-1_z(lambda)=R(phi,theta,lambda)R_z(-lambda)$$



    If you do the calculations right, you get $phi=arctan2(-R'_12,R'_22)$
    and $theta=arctan2(-R'_31,R'_33)$






    share|cite|improve this answer





















      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',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      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%2f2873176%2fcombining-two-rotations%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote













      You can express rotations as matrices. Their combination is found by matrix multiplication.



      In your case




      it performs a rotation on $z$ of $phi$ radians, then a rotation over
      $y$ of $theta$ radians, and finally a last rotation, again on $z$, of
      $lambda$ radians.




      we have:



      beginalign
      U
      &= R_z(lambda) , R_y(theta) , R_z(phi) \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta & 0 & -sintheta \
      0 & 1 & 0 \
      sintheta & 0 & costheta
      endpmatrix
      beginpmatrix
      cosphi & -sinphi & 0 \
      sinphi & cosphi & 0 \
      0 & 0 & 1
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta cosphi & -costheta sinphi & -sintheta \
      sinphi & cosphi & 0 \
      sintheta cosphi & -sintheta sinphi & costheta
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda costheta cosphi - sinlambda sinphi &
      -coslambda costheta sinphi - sinlambda cosphi &
      -coslambda sintheta \
      sinlambda costheta cosphi + coslambda sinphi &
      -sinlambda costheta sinphi + coslambda cosphi &
      -sinlambda sintheta \
      sintheta cosphi &
      -sintheta sinphi &
      costheta
      endpmatrix
      endalign
      This results in a single $3 times 3$ matrix.



      If you have two of those transformations $U_1$ and $U_2$ then the composition is given by the matrix product
      $$
      U_2 U_1
      $$
      One would have to calculate the resulting matrices and then check if it is possible to easily read the angles from the result.






      share|cite|improve this answer























      • I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
        – 4rzael
        9 hours ago










      • You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
        – mvw
        9 hours ago










      • Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
        – Andrei
        9 hours ago










      • @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
        – mvw
        9 hours ago











      • @mvw That's exactly what I was looking at :)
        – Andrei
        9 hours ago














      up vote
      2
      down vote













      You can express rotations as matrices. Their combination is found by matrix multiplication.



      In your case




      it performs a rotation on $z$ of $phi$ radians, then a rotation over
      $y$ of $theta$ radians, and finally a last rotation, again on $z$, of
      $lambda$ radians.




      we have:



      beginalign
      U
      &= R_z(lambda) , R_y(theta) , R_z(phi) \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta & 0 & -sintheta \
      0 & 1 & 0 \
      sintheta & 0 & costheta
      endpmatrix
      beginpmatrix
      cosphi & -sinphi & 0 \
      sinphi & cosphi & 0 \
      0 & 0 & 1
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta cosphi & -costheta sinphi & -sintheta \
      sinphi & cosphi & 0 \
      sintheta cosphi & -sintheta sinphi & costheta
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda costheta cosphi - sinlambda sinphi &
      -coslambda costheta sinphi - sinlambda cosphi &
      -coslambda sintheta \
      sinlambda costheta cosphi + coslambda sinphi &
      -sinlambda costheta sinphi + coslambda cosphi &
      -sinlambda sintheta \
      sintheta cosphi &
      -sintheta sinphi &
      costheta
      endpmatrix
      endalign
      This results in a single $3 times 3$ matrix.



      If you have two of those transformations $U_1$ and $U_2$ then the composition is given by the matrix product
      $$
      U_2 U_1
      $$
      One would have to calculate the resulting matrices and then check if it is possible to easily read the angles from the result.






      share|cite|improve this answer























      • I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
        – 4rzael
        9 hours ago










      • You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
        – mvw
        9 hours ago










      • Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
        – Andrei
        9 hours ago










      • @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
        – mvw
        9 hours ago











      • @mvw That's exactly what I was looking at :)
        – Andrei
        9 hours ago












      up vote
      2
      down vote










      up vote
      2
      down vote









      You can express rotations as matrices. Their combination is found by matrix multiplication.



      In your case




      it performs a rotation on $z$ of $phi$ radians, then a rotation over
      $y$ of $theta$ radians, and finally a last rotation, again on $z$, of
      $lambda$ radians.




      we have:



      beginalign
      U
      &= R_z(lambda) , R_y(theta) , R_z(phi) \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta & 0 & -sintheta \
      0 & 1 & 0 \
      sintheta & 0 & costheta
      endpmatrix
      beginpmatrix
      cosphi & -sinphi & 0 \
      sinphi & cosphi & 0 \
      0 & 0 & 1
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta cosphi & -costheta sinphi & -sintheta \
      sinphi & cosphi & 0 \
      sintheta cosphi & -sintheta sinphi & costheta
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda costheta cosphi - sinlambda sinphi &
      -coslambda costheta sinphi - sinlambda cosphi &
      -coslambda sintheta \
      sinlambda costheta cosphi + coslambda sinphi &
      -sinlambda costheta sinphi + coslambda cosphi &
      -sinlambda sintheta \
      sintheta cosphi &
      -sintheta sinphi &
      costheta
      endpmatrix
      endalign
      This results in a single $3 times 3$ matrix.



      If you have two of those transformations $U_1$ and $U_2$ then the composition is given by the matrix product
      $$
      U_2 U_1
      $$
      One would have to calculate the resulting matrices and then check if it is possible to easily read the angles from the result.






      share|cite|improve this answer















      You can express rotations as matrices. Their combination is found by matrix multiplication.



      In your case




      it performs a rotation on $z$ of $phi$ radians, then a rotation over
      $y$ of $theta$ radians, and finally a last rotation, again on $z$, of
      $lambda$ radians.




      we have:



      beginalign
      U
      &= R_z(lambda) , R_y(theta) , R_z(phi) \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta & 0 & -sintheta \
      0 & 1 & 0 \
      sintheta & 0 & costheta
      endpmatrix
      beginpmatrix
      cosphi & -sinphi & 0 \
      sinphi & cosphi & 0 \
      0 & 0 & 1
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda & -sinlambda & 0 \
      sinlambda & coslambda & 0 \
      0 & 0 & 1
      endpmatrix
      beginpmatrix
      costheta cosphi & -costheta sinphi & -sintheta \
      sinphi & cosphi & 0 \
      sintheta cosphi & -sintheta sinphi & costheta
      endpmatrix
      \
      &=
      beginpmatrix
      coslambda costheta cosphi - sinlambda sinphi &
      -coslambda costheta sinphi - sinlambda cosphi &
      -coslambda sintheta \
      sinlambda costheta cosphi + coslambda sinphi &
      -sinlambda costheta sinphi + coslambda cosphi &
      -sinlambda sintheta \
      sintheta cosphi &
      -sintheta sinphi &
      costheta
      endpmatrix
      endalign
      This results in a single $3 times 3$ matrix.



      If you have two of those transformations $U_1$ and $U_2$ then the composition is given by the matrix product
      $$
      U_2 U_1
      $$
      One would have to calculate the resulting matrices and then check if it is possible to easily read the angles from the result.







      share|cite|improve this answer















      share|cite|improve this answer



      share|cite|improve this answer








      edited 10 hours ago


























      answered 11 hours ago









      mvw

      30.1k22150




      30.1k22150











      • I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
        – 4rzael
        9 hours ago










      • You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
        – mvw
        9 hours ago










      • Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
        – Andrei
        9 hours ago










      • @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
        – mvw
        9 hours ago











      • @mvw That's exactly what I was looking at :)
        – Andrei
        9 hours ago
















      • I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
        – 4rzael
        9 hours ago










      • You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
        – mvw
        9 hours ago










      • Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
        – Andrei
        9 hours ago










      • @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
        – mvw
        9 hours ago











      • @mvw That's exactly what I was looking at :)
        – Andrei
        9 hours ago















      I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
      – 4rzael
      9 hours ago




      I already did the matrix transformation, but have no clue how to read the angles from the resulting matrix
      – 4rzael
      9 hours ago












      You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
      – mvw
      9 hours ago




      You can calculate $U_2 U_1$ for your given parameter sets and then try to fit that to a new matrix $U$. E.g. the last element is $cos theta$ and you should get the resulting $theta=arccos U_33$. Then use e.g. $U_23$ and $U_32$ to recover the resulting $lambda$ and $phi$. It is possible that there are several solutions.
      – mvw
      9 hours ago












      Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
      – Andrei
      9 hours ago




      Note that you have a sign issue. In the rotation matrix around $y$ axis the $+sin$ is in the upper corner.
      – Andrei
      9 hours ago












      @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
      – mvw
      9 hours ago





      @Andrei: You could be right, if I compare to this. No I idea what 4rzael uses. I would suggest to check the calculation anyways. :-)
      – mvw
      9 hours ago













      @mvw That's exactly what I was looking at :)
      – Andrei
      9 hours ago




      @mvw That's exactly what I was looking at :)
      – Andrei
      9 hours ago










      up vote
      0
      down vote













      A lot of details about this subject are in the Wikipedia article Euler angles. As an alternative, you can use
      quaternions as in the Wikipedia article Quaternion and spatial rotations and just multiply two or more quaternions.






      share|cite|improve this answer

























        up vote
        0
        down vote













        A lot of details about this subject are in the Wikipedia article Euler angles. As an alternative, you can use
        quaternions as in the Wikipedia article Quaternion and spatial rotations and just multiply two or more quaternions.






        share|cite|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          A lot of details about this subject are in the Wikipedia article Euler angles. As an alternative, you can use
          quaternions as in the Wikipedia article Quaternion and spatial rotations and just multiply two or more quaternions.






          share|cite|improve this answer













          A lot of details about this subject are in the Wikipedia article Euler angles. As an alternative, you can use
          quaternions as in the Wikipedia article Quaternion and spatial rotations and just multiply two or more quaternions.







          share|cite|improve this answer













          share|cite|improve this answer



          share|cite|improve this answer











          answered 10 hours ago









          Somos

          10.7k1830




          10.7k1830




















              up vote
              0
              down vote













              Start from the rotation matrix in terms of Euler angles. $$R(phi,theta,lambda)=beginpmatrixR_11& R_12 &R_13\R_21& R_22 &R_23\R_31& R_32 &R_33endpmatrix$$



              First calculate the inner most angle. If $R_31$ and $R_32$ are both zero, use $lambda=0$. Otherwise $$tanlambda=fracR_32-R_31$$ You can use the $arctan2$ function
              $$lambda=arctan2 (R_32,-R_31)$$



              Now calculate $$R'(phi,theta)=R(phi,theta,lambda)R^-1_z(lambda)=R(phi,theta,lambda)R_z(-lambda)$$



              If you do the calculations right, you get $phi=arctan2(-R'_12,R'_22)$
              and $theta=arctan2(-R'_31,R'_33)$






              share|cite|improve this answer

























                up vote
                0
                down vote













                Start from the rotation matrix in terms of Euler angles. $$R(phi,theta,lambda)=beginpmatrixR_11& R_12 &R_13\R_21& R_22 &R_23\R_31& R_32 &R_33endpmatrix$$



                First calculate the inner most angle. If $R_31$ and $R_32$ are both zero, use $lambda=0$. Otherwise $$tanlambda=fracR_32-R_31$$ You can use the $arctan2$ function
                $$lambda=arctan2 (R_32,-R_31)$$



                Now calculate $$R'(phi,theta)=R(phi,theta,lambda)R^-1_z(lambda)=R(phi,theta,lambda)R_z(-lambda)$$



                If you do the calculations right, you get $phi=arctan2(-R'_12,R'_22)$
                and $theta=arctan2(-R'_31,R'_33)$






                share|cite|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Start from the rotation matrix in terms of Euler angles. $$R(phi,theta,lambda)=beginpmatrixR_11& R_12 &R_13\R_21& R_22 &R_23\R_31& R_32 &R_33endpmatrix$$



                  First calculate the inner most angle. If $R_31$ and $R_32$ are both zero, use $lambda=0$. Otherwise $$tanlambda=fracR_32-R_31$$ You can use the $arctan2$ function
                  $$lambda=arctan2 (R_32,-R_31)$$



                  Now calculate $$R'(phi,theta)=R(phi,theta,lambda)R^-1_z(lambda)=R(phi,theta,lambda)R_z(-lambda)$$



                  If you do the calculations right, you get $phi=arctan2(-R'_12,R'_22)$
                  and $theta=arctan2(-R'_31,R'_33)$






                  share|cite|improve this answer













                  Start from the rotation matrix in terms of Euler angles. $$R(phi,theta,lambda)=beginpmatrixR_11& R_12 &R_13\R_21& R_22 &R_23\R_31& R_32 &R_33endpmatrix$$



                  First calculate the inner most angle. If $R_31$ and $R_32$ are both zero, use $lambda=0$. Otherwise $$tanlambda=fracR_32-R_31$$ You can use the $arctan2$ function
                  $$lambda=arctan2 (R_32,-R_31)$$



                  Now calculate $$R'(phi,theta)=R(phi,theta,lambda)R^-1_z(lambda)=R(phi,theta,lambda)R_z(-lambda)$$



                  If you do the calculations right, you get $phi=arctan2(-R'_12,R'_22)$
                  and $theta=arctan2(-R'_31,R'_33)$







                  share|cite|improve this answer













                  share|cite|improve this answer



                  share|cite|improve this answer











                  answered 9 hours ago









                  Andrei

                  7,3302822




                  7,3302822






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2873176%2fcombining-two-rotations%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What is the equation of a 3D cone with generalised tilt?

                      Color the edges and diagonals of a regular polygon

                      Relationship between determinant of matrix and determinant of adjoint?