Rotation Matrix and of rotation around a point

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











up vote
11
down vote

favorite
4












In homogeneous coordinates, a rotation matrix around the origin can be described as



$R = beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix$



with the angle $theta$ and the rotation being counter-clockwise.



A translation amongst $x$ and $y$ can be defined as:



$T(x,y) = beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix$



As I understand, the rotation matrix around an arbitrary point, can be expressed as moving the rotation point to the origin, rotating around the origin and moving back to the original position. Is it true, that this operations can be described in a simple multiplication of



$T(x,y) * R * T(-x,-y) qquad (I)$



I find this to be counter-intuitive. In my understanding, it should be



$T(-x,-y) * R * T(x,y) qquad (II)$



Update:



The two formulations are definitely not equal.
The first equation yields



$E1 = beginbmatrixcos(theta) & -sin(theta) & -xcdotcos(theta)+x+ycdotsin(theta)\sin(theta) & cos(theta) & -xcdotsin(theta)-ycdotcos(theta)+y \ 0&0&1endbmatrix$



The second one:



$E2 = beginbmatrixcos(theta) & -sin(theta) & xcdotcos(theta)-x-ycdotsin(theta)\sin(theta) & cos(theta) & xcdotsin(theta)+ycdotcos(theta)-y \ 0&0&1endbmatrix$







share|cite|improve this question


























    up vote
    11
    down vote

    favorite
    4












    In homogeneous coordinates, a rotation matrix around the origin can be described as



    $R = beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix$



    with the angle $theta$ and the rotation being counter-clockwise.



    A translation amongst $x$ and $y$ can be defined as:



    $T(x,y) = beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix$



    As I understand, the rotation matrix around an arbitrary point, can be expressed as moving the rotation point to the origin, rotating around the origin and moving back to the original position. Is it true, that this operations can be described in a simple multiplication of



    $T(x,y) * R * T(-x,-y) qquad (I)$



    I find this to be counter-intuitive. In my understanding, it should be



    $T(-x,-y) * R * T(x,y) qquad (II)$



    Update:



    The two formulations are definitely not equal.
    The first equation yields



    $E1 = beginbmatrixcos(theta) & -sin(theta) & -xcdotcos(theta)+x+ycdotsin(theta)\sin(theta) & cos(theta) & -xcdotsin(theta)-ycdotcos(theta)+y \ 0&0&1endbmatrix$



    The second one:



    $E2 = beginbmatrixcos(theta) & -sin(theta) & xcdotcos(theta)-x-ycdotsin(theta)\sin(theta) & cos(theta) & xcdotsin(theta)+ycdotcos(theta)-y \ 0&0&1endbmatrix$







    share|cite|improve this question
























      up vote
      11
      down vote

      favorite
      4









      up vote
      11
      down vote

      favorite
      4






      4





      In homogeneous coordinates, a rotation matrix around the origin can be described as



      $R = beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix$



      with the angle $theta$ and the rotation being counter-clockwise.



      A translation amongst $x$ and $y$ can be defined as:



      $T(x,y) = beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix$



      As I understand, the rotation matrix around an arbitrary point, can be expressed as moving the rotation point to the origin, rotating around the origin and moving back to the original position. Is it true, that this operations can be described in a simple multiplication of



      $T(x,y) * R * T(-x,-y) qquad (I)$



      I find this to be counter-intuitive. In my understanding, it should be



      $T(-x,-y) * R * T(x,y) qquad (II)$



      Update:



      The two formulations are definitely not equal.
      The first equation yields



      $E1 = beginbmatrixcos(theta) & -sin(theta) & -xcdotcos(theta)+x+ycdotsin(theta)\sin(theta) & cos(theta) & -xcdotsin(theta)-ycdotcos(theta)+y \ 0&0&1endbmatrix$



      The second one:



      $E2 = beginbmatrixcos(theta) & -sin(theta) & xcdotcos(theta)-x-ycdotsin(theta)\sin(theta) & cos(theta) & xcdotsin(theta)+ycdotcos(theta)-y \ 0&0&1endbmatrix$







      share|cite|improve this question














      In homogeneous coordinates, a rotation matrix around the origin can be described as



      $R = beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix$



      with the angle $theta$ and the rotation being counter-clockwise.



      A translation amongst $x$ and $y$ can be defined as:



      $T(x,y) = beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix$



      As I understand, the rotation matrix around an arbitrary point, can be expressed as moving the rotation point to the origin, rotating around the origin and moving back to the original position. Is it true, that this operations can be described in a simple multiplication of



      $T(x,y) * R * T(-x,-y) qquad (I)$



      I find this to be counter-intuitive. In my understanding, it should be



      $T(-x,-y) * R * T(x,y) qquad (II)$



      Update:



      The two formulations are definitely not equal.
      The first equation yields



      $E1 = beginbmatrixcos(theta) & -sin(theta) & -xcdotcos(theta)+x+ycdotsin(theta)\sin(theta) & cos(theta) & -xcdotsin(theta)-ycdotcos(theta)+y \ 0&0&1endbmatrix$



      The second one:



      $E2 = beginbmatrixcos(theta) & -sin(theta) & xcdotcos(theta)-x-ycdotsin(theta)\sin(theta) & cos(theta) & xcdotsin(theta)+ycdotcos(theta)-y \ 0&0&1endbmatrix$









      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Jan 11 '17 at 13:38

























      asked Jan 11 '17 at 13:24









      Dschoni

      179110




      179110




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          11
          down vote



          accepted










          Your first formula is correct. Remember, the point to which this is applied appears on the RIGHT:
          $$
          T(x,y) * R * T(-x,-y) (P)
          $$
          So to evaluate the expression above, we first translate $P$ by $(-x, -y)$, then rotate the result, then translate back. Let's see what happens when $P$ is the point $(x, y, 1)$. That amounts to evaluating the following product:
          beginalign
          f((x, y))
          &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
          beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
          beginbmatrix1&0&-x\ 0& 1&-y\0&0&1endbmatrix
          beginbmatrixx\ y\1endbmatrix\
          &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
          beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
          beginbmatrix0\ 0\1endbmatrix\
          &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
          beginbmatrix0\ 0\1endbmatrix\
          &= beginbmatrixx\ y\1endbmatrix\
          endalign
          as expected: the point $(x, y)$ remains fixed by this composite transformation.






          share|cite|improve this answer



























            up vote
            5
            down vote













            These matrices are left-side multiplicated with vector positions, so the order of multiplication is from right to left - on the right side is the first operation, on the left side - the last one.






            share|cite|improve this answer



























              up vote
              5
              down vote













              The point is, that you're shifting the coordinate system, not the point.

              So you don't actually shift the point to the origin, you shift the origin to the point, and then back.






              share|cite|improve this answer






















              • Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                – ToolmakerSteve
                Mar 22 at 14:09











              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%2f2093314%2frotation-matrix-and-of-rotation-around-a-point%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
              11
              down vote



              accepted










              Your first formula is correct. Remember, the point to which this is applied appears on the RIGHT:
              $$
              T(x,y) * R * T(-x,-y) (P)
              $$
              So to evaluate the expression above, we first translate $P$ by $(-x, -y)$, then rotate the result, then translate back. Let's see what happens when $P$ is the point $(x, y, 1)$. That amounts to evaluating the following product:
              beginalign
              f((x, y))
              &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
              beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
              beginbmatrix1&0&-x\ 0& 1&-y\0&0&1endbmatrix
              beginbmatrixx\ y\1endbmatrix\
              &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
              beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
              beginbmatrix0\ 0\1endbmatrix\
              &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
              beginbmatrix0\ 0\1endbmatrix\
              &= beginbmatrixx\ y\1endbmatrix\
              endalign
              as expected: the point $(x, y)$ remains fixed by this composite transformation.






              share|cite|improve this answer
























                up vote
                11
                down vote



                accepted










                Your first formula is correct. Remember, the point to which this is applied appears on the RIGHT:
                $$
                T(x,y) * R * T(-x,-y) (P)
                $$
                So to evaluate the expression above, we first translate $P$ by $(-x, -y)$, then rotate the result, then translate back. Let's see what happens when $P$ is the point $(x, y, 1)$. That amounts to evaluating the following product:
                beginalign
                f((x, y))
                &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
                beginbmatrix1&0&-x\ 0& 1&-y\0&0&1endbmatrix
                beginbmatrixx\ y\1endbmatrix\
                &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
                beginbmatrix0\ 0\1endbmatrix\
                &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                beginbmatrix0\ 0\1endbmatrix\
                &= beginbmatrixx\ y\1endbmatrix\
                endalign
                as expected: the point $(x, y)$ remains fixed by this composite transformation.






                share|cite|improve this answer






















                  up vote
                  11
                  down vote



                  accepted







                  up vote
                  11
                  down vote



                  accepted






                  Your first formula is correct. Remember, the point to which this is applied appears on the RIGHT:
                  $$
                  T(x,y) * R * T(-x,-y) (P)
                  $$
                  So to evaluate the expression above, we first translate $P$ by $(-x, -y)$, then rotate the result, then translate back. Let's see what happens when $P$ is the point $(x, y, 1)$. That amounts to evaluating the following product:
                  beginalign
                  f((x, y))
                  &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                  beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
                  beginbmatrix1&0&-x\ 0& 1&-y\0&0&1endbmatrix
                  beginbmatrixx\ y\1endbmatrix\
                  &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                  beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
                  beginbmatrix0\ 0\1endbmatrix\
                  &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                  beginbmatrix0\ 0\1endbmatrix\
                  &= beginbmatrixx\ y\1endbmatrix\
                  endalign
                  as expected: the point $(x, y)$ remains fixed by this composite transformation.






                  share|cite|improve this answer












                  Your first formula is correct. Remember, the point to which this is applied appears on the RIGHT:
                  $$
                  T(x,y) * R * T(-x,-y) (P)
                  $$
                  So to evaluate the expression above, we first translate $P$ by $(-x, -y)$, then rotate the result, then translate back. Let's see what happens when $P$ is the point $(x, y, 1)$. That amounts to evaluating the following product:
                  beginalign
                  f((x, y))
                  &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                  beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
                  beginbmatrix1&0&-x\ 0& 1&-y\0&0&1endbmatrix
                  beginbmatrixx\ y\1endbmatrix\
                  &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                  beginbmatrixcos(theta) & -sin(theta) & 0\sin(theta) & cos(theta) & 0 \ 0&0&1endbmatrix
                  beginbmatrix0\ 0\1endbmatrix\
                  &= beginbmatrix1&0&x\ 0& 1&y\0&0&1endbmatrix
                  beginbmatrix0\ 0\1endbmatrix\
                  &= beginbmatrixx\ y\1endbmatrix\
                  endalign
                  as expected: the point $(x, y)$ remains fixed by this composite transformation.







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Jan 11 '17 at 13:33









                  John Hughes

                  59.5k23786




                  59.5k23786




















                      up vote
                      5
                      down vote













                      These matrices are left-side multiplicated with vector positions, so the order of multiplication is from right to left - on the right side is the first operation, on the left side - the last one.






                      share|cite|improve this answer
























                        up vote
                        5
                        down vote













                        These matrices are left-side multiplicated with vector positions, so the order of multiplication is from right to left - on the right side is the first operation, on the left side - the last one.






                        share|cite|improve this answer






















                          up vote
                          5
                          down vote










                          up vote
                          5
                          down vote









                          These matrices are left-side multiplicated with vector positions, so the order of multiplication is from right to left - on the right side is the first operation, on the left side - the last one.






                          share|cite|improve this answer












                          These matrices are left-side multiplicated with vector positions, so the order of multiplication is from right to left - on the right side is the first operation, on the left side - the last one.







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Jan 11 '17 at 13:39









                          Jaroslaw Matlak

                          3,900830




                          3,900830




















                              up vote
                              5
                              down vote













                              The point is, that you're shifting the coordinate system, not the point.

                              So you don't actually shift the point to the origin, you shift the origin to the point, and then back.






                              share|cite|improve this answer






















                              • Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                                – ToolmakerSteve
                                Mar 22 at 14:09















                              up vote
                              5
                              down vote













                              The point is, that you're shifting the coordinate system, not the point.

                              So you don't actually shift the point to the origin, you shift the origin to the point, and then back.






                              share|cite|improve this answer






















                              • Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                                – ToolmakerSteve
                                Mar 22 at 14:09













                              up vote
                              5
                              down vote










                              up vote
                              5
                              down vote









                              The point is, that you're shifting the coordinate system, not the point.

                              So you don't actually shift the point to the origin, you shift the origin to the point, and then back.






                              share|cite|improve this answer














                              The point is, that you're shifting the coordinate system, not the point.

                              So you don't actually shift the point to the origin, you shift the origin to the point, and then back.







                              share|cite|improve this answer














                              share|cite|improve this answer



                              share|cite|improve this answer








                              edited Aug 16 at 6:56

























                              answered May 22 '17 at 10:57









                              Quandary

                              15114




                              15114











                              • Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                                – ToolmakerSteve
                                Mar 22 at 14:09

















                              • Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                                – ToolmakerSteve
                                Mar 22 at 14:09
















                              Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                              – ToolmakerSteve
                              Mar 22 at 14:09





                              Regardless of whether you think of the math as "shifting the coordinate system" or "shifting the point", the first operation you apply, as John Hughes correctly explains, is T(-x, -y). If that transform is applied to the point, the result is (0, 0). IMHO its simpler to get this math correct, if you think of this operation as "shifting the point to the origin". Hmm, or maybe you are working with post-multiplications rather than pre-multiplications. So its a question of POV.
                              – ToolmakerSteve
                              Mar 22 at 14:09













                               

                              draft saved


                              draft discarded


























                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2093314%2frotation-matrix-and-of-rotation-around-a-point%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              這個網誌中的熱門文章

                              How to combine Bézier curves to a surface?

                              Mutual Information Always Non-negative

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