Improper Quaternion value derived from the difference of Euler Angles?

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











up vote
1
down vote

favorite












A Quaternion (x,y,z,w) can be derived from Euler angles (x,y,z). Of course, these values need to be perfectly accurate or the Quaternion formula i^2 = j^2 = k^2 = ijk = −1 might be off, which can cause inaccurate rotations.



I have no problem deriving a quaternion from the Euler angles derived from another quaternion, since the Euler angles have been properly derived from quaternion values. However, when subtracting 2 Euler Angle vectors (x,y,z) - (x,y,z) and then deriving a quaternion from that difference vector, I'm getting the wrong quaternion values. I don't think messing with Euler angles is the right approach.



I have 2 quaternions (Q1 and Q2).



I have the Euler angles of both Q1 and Q2 (P1 and P2).



I want to get Q3 from the difference between P1 and P2.



Instead of subtracting P2 from P1 to derive a new quaternion, should I get Q3 from the difference between Q1 and Q2?



Is there a way to get Q3 without using Euler angles?







share|cite|improve this question


























    up vote
    1
    down vote

    favorite












    A Quaternion (x,y,z,w) can be derived from Euler angles (x,y,z). Of course, these values need to be perfectly accurate or the Quaternion formula i^2 = j^2 = k^2 = ijk = −1 might be off, which can cause inaccurate rotations.



    I have no problem deriving a quaternion from the Euler angles derived from another quaternion, since the Euler angles have been properly derived from quaternion values. However, when subtracting 2 Euler Angle vectors (x,y,z) - (x,y,z) and then deriving a quaternion from that difference vector, I'm getting the wrong quaternion values. I don't think messing with Euler angles is the right approach.



    I have 2 quaternions (Q1 and Q2).



    I have the Euler angles of both Q1 and Q2 (P1 and P2).



    I want to get Q3 from the difference between P1 and P2.



    Instead of subtracting P2 from P1 to derive a new quaternion, should I get Q3 from the difference between Q1 and Q2?



    Is there a way to get Q3 without using Euler angles?







    share|cite|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      A Quaternion (x,y,z,w) can be derived from Euler angles (x,y,z). Of course, these values need to be perfectly accurate or the Quaternion formula i^2 = j^2 = k^2 = ijk = −1 might be off, which can cause inaccurate rotations.



      I have no problem deriving a quaternion from the Euler angles derived from another quaternion, since the Euler angles have been properly derived from quaternion values. However, when subtracting 2 Euler Angle vectors (x,y,z) - (x,y,z) and then deriving a quaternion from that difference vector, I'm getting the wrong quaternion values. I don't think messing with Euler angles is the right approach.



      I have 2 quaternions (Q1 and Q2).



      I have the Euler angles of both Q1 and Q2 (P1 and P2).



      I want to get Q3 from the difference between P1 and P2.



      Instead of subtracting P2 from P1 to derive a new quaternion, should I get Q3 from the difference between Q1 and Q2?



      Is there a way to get Q3 without using Euler angles?







      share|cite|improve this question














      A Quaternion (x,y,z,w) can be derived from Euler angles (x,y,z). Of course, these values need to be perfectly accurate or the Quaternion formula i^2 = j^2 = k^2 = ijk = −1 might be off, which can cause inaccurate rotations.



      I have no problem deriving a quaternion from the Euler angles derived from another quaternion, since the Euler angles have been properly derived from quaternion values. However, when subtracting 2 Euler Angle vectors (x,y,z) - (x,y,z) and then deriving a quaternion from that difference vector, I'm getting the wrong quaternion values. I don't think messing with Euler angles is the right approach.



      I have 2 quaternions (Q1 and Q2).



      I have the Euler angles of both Q1 and Q2 (P1 and P2).



      I want to get Q3 from the difference between P1 and P2.



      Instead of subtracting P2 from P1 to derive a new quaternion, should I get Q3 from the difference between Q1 and Q2?



      Is there a way to get Q3 without using Euler angles?









      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Aug 9 at 20:45

























      asked Aug 9 at 20:27









      karamazovbros

      84




      84




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You have two quaternions, $q_1$ and $q_2$. What is the signficance of those quaternions to you; what do you want them for?



          You want to derive a third quaternion, $q_3.$ What is its signficance; what do you want it for?



          Often people use quaternions to represent rotations in three-dimensional space.
          The fact that you mention Euler angles suggests that this is what you want the quaternions for.



          What do you think the "difference" between two rotations means?
          The difference between two numbers, $a$ and $b,$ is the amount you have to add to $b$ so that the sum will be $a.$
          A kind of "difference" between two rotations $R_1$ and $R_2$ arises if you have performed the rotation $R_2,$ and you want to know what further rotation to perform so that the final result will be the same as if you had just done the rotation $R_1$ by itself.
          That is $R_2$ "plus" the "difference" should equal $R_1,$
          except that we do not usually say "plus" when we are combining rotations.
          More typically we would say "followed by."



          In two dimensions, where you can only rotate around an axis perpendicular to the plane of your figures, you can get away with just subtracting one rotation angle from another to get the "difference" between the two rotations.
          In three dimensions this does not generally work.
          Subtracting one vector of Euler angles from another is generally a nonsense operation. It is only useful as an approximation, and only when the angles are small.



          If you're using quaternions to keep track of your rotations, however, you're in luck, because the result of doing the rotation of quaternion $q_2$ and then doing the rotation $q_3$ is $q_2 q_3,$ that is, $q_2$ multiplied by $q_3$ (or it might be $q_3 q_2$ depending on how you are using the quaternions to do your rotations; multiplication of quaternions is not commutative).



          So it seems likely (if you are making this very common use of quaternions) that what you really want to find is the quaternion $q_3$ such that
          $$ q_2 q_3 = q_1.$$



          To find $q_3$ you just need to find the multiplicative inverse of $q_2,$ which is called $q_2^-1,$ and multiply as follows:
          $$ q_2^-1 q_1 = q_2^-1 (q_2 q_3) = (q_2^-1 q_2) q_3 = q_3. $$



          In short,
          $$ q_3 = q_2^-1 q_1. $$






          share|cite|improve this answer






















          • I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
            – karamazovbros
            Aug 9 at 21:03










          • You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
            – David K
            Aug 9 at 21:07










          • Thanks David, works perfectly!
            – karamazovbros
            Aug 9 at 22:31










          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%2f2877659%2fimproper-quaternion-value-derived-from-the-difference-of-euler-angles%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          You have two quaternions, $q_1$ and $q_2$. What is the signficance of those quaternions to you; what do you want them for?



          You want to derive a third quaternion, $q_3.$ What is its signficance; what do you want it for?



          Often people use quaternions to represent rotations in three-dimensional space.
          The fact that you mention Euler angles suggests that this is what you want the quaternions for.



          What do you think the "difference" between two rotations means?
          The difference between two numbers, $a$ and $b,$ is the amount you have to add to $b$ so that the sum will be $a.$
          A kind of "difference" between two rotations $R_1$ and $R_2$ arises if you have performed the rotation $R_2,$ and you want to know what further rotation to perform so that the final result will be the same as if you had just done the rotation $R_1$ by itself.
          That is $R_2$ "plus" the "difference" should equal $R_1,$
          except that we do not usually say "plus" when we are combining rotations.
          More typically we would say "followed by."



          In two dimensions, where you can only rotate around an axis perpendicular to the plane of your figures, you can get away with just subtracting one rotation angle from another to get the "difference" between the two rotations.
          In three dimensions this does not generally work.
          Subtracting one vector of Euler angles from another is generally a nonsense operation. It is only useful as an approximation, and only when the angles are small.



          If you're using quaternions to keep track of your rotations, however, you're in luck, because the result of doing the rotation of quaternion $q_2$ and then doing the rotation $q_3$ is $q_2 q_3,$ that is, $q_2$ multiplied by $q_3$ (or it might be $q_3 q_2$ depending on how you are using the quaternions to do your rotations; multiplication of quaternions is not commutative).



          So it seems likely (if you are making this very common use of quaternions) that what you really want to find is the quaternion $q_3$ such that
          $$ q_2 q_3 = q_1.$$



          To find $q_3$ you just need to find the multiplicative inverse of $q_2,$ which is called $q_2^-1,$ and multiply as follows:
          $$ q_2^-1 q_1 = q_2^-1 (q_2 q_3) = (q_2^-1 q_2) q_3 = q_3. $$



          In short,
          $$ q_3 = q_2^-1 q_1. $$






          share|cite|improve this answer






















          • I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
            – karamazovbros
            Aug 9 at 21:03










          • You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
            – David K
            Aug 9 at 21:07










          • Thanks David, works perfectly!
            – karamazovbros
            Aug 9 at 22:31














          up vote
          1
          down vote



          accepted










          You have two quaternions, $q_1$ and $q_2$. What is the signficance of those quaternions to you; what do you want them for?



          You want to derive a third quaternion, $q_3.$ What is its signficance; what do you want it for?



          Often people use quaternions to represent rotations in three-dimensional space.
          The fact that you mention Euler angles suggests that this is what you want the quaternions for.



          What do you think the "difference" between two rotations means?
          The difference between two numbers, $a$ and $b,$ is the amount you have to add to $b$ so that the sum will be $a.$
          A kind of "difference" between two rotations $R_1$ and $R_2$ arises if you have performed the rotation $R_2,$ and you want to know what further rotation to perform so that the final result will be the same as if you had just done the rotation $R_1$ by itself.
          That is $R_2$ "plus" the "difference" should equal $R_1,$
          except that we do not usually say "plus" when we are combining rotations.
          More typically we would say "followed by."



          In two dimensions, where you can only rotate around an axis perpendicular to the plane of your figures, you can get away with just subtracting one rotation angle from another to get the "difference" between the two rotations.
          In three dimensions this does not generally work.
          Subtracting one vector of Euler angles from another is generally a nonsense operation. It is only useful as an approximation, and only when the angles are small.



          If you're using quaternions to keep track of your rotations, however, you're in luck, because the result of doing the rotation of quaternion $q_2$ and then doing the rotation $q_3$ is $q_2 q_3,$ that is, $q_2$ multiplied by $q_3$ (or it might be $q_3 q_2$ depending on how you are using the quaternions to do your rotations; multiplication of quaternions is not commutative).



          So it seems likely (if you are making this very common use of quaternions) that what you really want to find is the quaternion $q_3$ such that
          $$ q_2 q_3 = q_1.$$



          To find $q_3$ you just need to find the multiplicative inverse of $q_2,$ which is called $q_2^-1,$ and multiply as follows:
          $$ q_2^-1 q_1 = q_2^-1 (q_2 q_3) = (q_2^-1 q_2) q_3 = q_3. $$



          In short,
          $$ q_3 = q_2^-1 q_1. $$






          share|cite|improve this answer






















          • I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
            – karamazovbros
            Aug 9 at 21:03










          • You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
            – David K
            Aug 9 at 21:07










          • Thanks David, works perfectly!
            – karamazovbros
            Aug 9 at 22:31












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          You have two quaternions, $q_1$ and $q_2$. What is the signficance of those quaternions to you; what do you want them for?



          You want to derive a third quaternion, $q_3.$ What is its signficance; what do you want it for?



          Often people use quaternions to represent rotations in three-dimensional space.
          The fact that you mention Euler angles suggests that this is what you want the quaternions for.



          What do you think the "difference" between two rotations means?
          The difference between two numbers, $a$ and $b,$ is the amount you have to add to $b$ so that the sum will be $a.$
          A kind of "difference" between two rotations $R_1$ and $R_2$ arises if you have performed the rotation $R_2,$ and you want to know what further rotation to perform so that the final result will be the same as if you had just done the rotation $R_1$ by itself.
          That is $R_2$ "plus" the "difference" should equal $R_1,$
          except that we do not usually say "plus" when we are combining rotations.
          More typically we would say "followed by."



          In two dimensions, where you can only rotate around an axis perpendicular to the plane of your figures, you can get away with just subtracting one rotation angle from another to get the "difference" between the two rotations.
          In three dimensions this does not generally work.
          Subtracting one vector of Euler angles from another is generally a nonsense operation. It is only useful as an approximation, and only when the angles are small.



          If you're using quaternions to keep track of your rotations, however, you're in luck, because the result of doing the rotation of quaternion $q_2$ and then doing the rotation $q_3$ is $q_2 q_3,$ that is, $q_2$ multiplied by $q_3$ (or it might be $q_3 q_2$ depending on how you are using the quaternions to do your rotations; multiplication of quaternions is not commutative).



          So it seems likely (if you are making this very common use of quaternions) that what you really want to find is the quaternion $q_3$ such that
          $$ q_2 q_3 = q_1.$$



          To find $q_3$ you just need to find the multiplicative inverse of $q_2,$ which is called $q_2^-1,$ and multiply as follows:
          $$ q_2^-1 q_1 = q_2^-1 (q_2 q_3) = (q_2^-1 q_2) q_3 = q_3. $$



          In short,
          $$ q_3 = q_2^-1 q_1. $$






          share|cite|improve this answer














          You have two quaternions, $q_1$ and $q_2$. What is the signficance of those quaternions to you; what do you want them for?



          You want to derive a third quaternion, $q_3.$ What is its signficance; what do you want it for?



          Often people use quaternions to represent rotations in three-dimensional space.
          The fact that you mention Euler angles suggests that this is what you want the quaternions for.



          What do you think the "difference" between two rotations means?
          The difference between two numbers, $a$ and $b,$ is the amount you have to add to $b$ so that the sum will be $a.$
          A kind of "difference" between two rotations $R_1$ and $R_2$ arises if you have performed the rotation $R_2,$ and you want to know what further rotation to perform so that the final result will be the same as if you had just done the rotation $R_1$ by itself.
          That is $R_2$ "plus" the "difference" should equal $R_1,$
          except that we do not usually say "plus" when we are combining rotations.
          More typically we would say "followed by."



          In two dimensions, where you can only rotate around an axis perpendicular to the plane of your figures, you can get away with just subtracting one rotation angle from another to get the "difference" between the two rotations.
          In three dimensions this does not generally work.
          Subtracting one vector of Euler angles from another is generally a nonsense operation. It is only useful as an approximation, and only when the angles are small.



          If you're using quaternions to keep track of your rotations, however, you're in luck, because the result of doing the rotation of quaternion $q_2$ and then doing the rotation $q_3$ is $q_2 q_3,$ that is, $q_2$ multiplied by $q_3$ (or it might be $q_3 q_2$ depending on how you are using the quaternions to do your rotations; multiplication of quaternions is not commutative).



          So it seems likely (if you are making this very common use of quaternions) that what you really want to find is the quaternion $q_3$ such that
          $$ q_2 q_3 = q_1.$$



          To find $q_3$ you just need to find the multiplicative inverse of $q_2,$ which is called $q_2^-1,$ and multiply as follows:
          $$ q_2^-1 q_1 = q_2^-1 (q_2 q_3) = (q_2^-1 q_2) q_3 = q_3. $$



          In short,
          $$ q_3 = q_2^-1 q_1. $$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Aug 9 at 20:56

























          answered Aug 9 at 20:50









          David K

          48.5k340108




          48.5k340108











          • I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
            – karamazovbros
            Aug 9 at 21:03










          • You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
            – David K
            Aug 9 at 21:07










          • Thanks David, works perfectly!
            – karamazovbros
            Aug 9 at 22:31
















          • I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
            – karamazovbros
            Aug 9 at 21:03










          • You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
            – David K
            Aug 9 at 21:07










          • Thanks David, works perfectly!
            – karamazovbros
            Aug 9 at 22:31















          I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
          – karamazovbros
          Aug 9 at 21:03




          I'll try this out. Yes, the quaternions are being used for rotations in 3D space. Is the inverse of Q2 in your answer the conjugate, where the inverse it w, -x, -y, -z?
          – karamazovbros
          Aug 9 at 21:03












          You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
          – David K
          Aug 9 at 21:07




          You have to divide the conjugate by $(w^2 + x^2 + y^2 + z^2)$ to get the multiplicative inverse.
          – David K
          Aug 9 at 21:07












          Thanks David, works perfectly!
          – karamazovbros
          Aug 9 at 22:31




          Thanks David, works perfectly!
          – karamazovbros
          Aug 9 at 22:31












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2877659%2fimproper-quaternion-value-derived-from-the-difference-of-euler-angles%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          Is there any way to eliminate the singular point to solve this integral by hand or by approximations?

          Why am i infinitely getting the same tweet with the Twitter Search API?

          Carbon dioxide