Is it the Global frame-of-reference or Local frame-of-reference of the rotation











up vote
0
down vote

favorite












I need to translate the rotation matrix to Euler angle.



And following this blog https://www.learnopencv.com/rotation-matrix-to-euler-angles/, I saw the Python code like (using order 'z, y, x'):



def rotation_matrix_to_euler_angles(matrix):     
sy = math.sqrt(matrix[0,0] * matrix[0,0] + matrix[1,0] * matrix[1,0])

singular = sy < 1e-6

if not singular :
x = math.atan2(matrix[2, 1] , matrix[2, 2])
y = math.atan2(-matrix[2,0], sy)
z = math.atan2(matrix[1,0], matrix[0,0])
else :
x = math.atan2(-matrix[1, 2], matrix[1, 1])
y = math.atan2(-matrix[2,0], sy)
z = 0

return [x, y, z]


Or you can find the other solutions for other orders in:
https://www.geometrictools.com/Documentation/EulerAngles.pdf



But in the blog and in the PDF, they didn't mention which frame-of-reference they were using. So I am not sure, this solution is Global frame-of-reference or Local frame-of-reference of the rotation.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I need to translate the rotation matrix to Euler angle.



    And following this blog https://www.learnopencv.com/rotation-matrix-to-euler-angles/, I saw the Python code like (using order 'z, y, x'):



    def rotation_matrix_to_euler_angles(matrix):     
    sy = math.sqrt(matrix[0,0] * matrix[0,0] + matrix[1,0] * matrix[1,0])

    singular = sy < 1e-6

    if not singular :
    x = math.atan2(matrix[2, 1] , matrix[2, 2])
    y = math.atan2(-matrix[2,0], sy)
    z = math.atan2(matrix[1,0], matrix[0,0])
    else :
    x = math.atan2(-matrix[1, 2], matrix[1, 1])
    y = math.atan2(-matrix[2,0], sy)
    z = 0

    return [x, y, z]


    Or you can find the other solutions for other orders in:
    https://www.geometrictools.com/Documentation/EulerAngles.pdf



    But in the blog and in the PDF, they didn't mention which frame-of-reference they were using. So I am not sure, this solution is Global frame-of-reference or Local frame-of-reference of the rotation.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I need to translate the rotation matrix to Euler angle.



      And following this blog https://www.learnopencv.com/rotation-matrix-to-euler-angles/, I saw the Python code like (using order 'z, y, x'):



      def rotation_matrix_to_euler_angles(matrix):     
      sy = math.sqrt(matrix[0,0] * matrix[0,0] + matrix[1,0] * matrix[1,0])

      singular = sy < 1e-6

      if not singular :
      x = math.atan2(matrix[2, 1] , matrix[2, 2])
      y = math.atan2(-matrix[2,0], sy)
      z = math.atan2(matrix[1,0], matrix[0,0])
      else :
      x = math.atan2(-matrix[1, 2], matrix[1, 1])
      y = math.atan2(-matrix[2,0], sy)
      z = 0

      return [x, y, z]


      Or you can find the other solutions for other orders in:
      https://www.geometrictools.com/Documentation/EulerAngles.pdf



      But in the blog and in the PDF, they didn't mention which frame-of-reference they were using. So I am not sure, this solution is Global frame-of-reference or Local frame-of-reference of the rotation.










      share|improve this question















      I need to translate the rotation matrix to Euler angle.



      And following this blog https://www.learnopencv.com/rotation-matrix-to-euler-angles/, I saw the Python code like (using order 'z, y, x'):



      def rotation_matrix_to_euler_angles(matrix):     
      sy = math.sqrt(matrix[0,0] * matrix[0,0] + matrix[1,0] * matrix[1,0])

      singular = sy < 1e-6

      if not singular :
      x = math.atan2(matrix[2, 1] , matrix[2, 2])
      y = math.atan2(-matrix[2,0], sy)
      z = math.atan2(matrix[1,0], matrix[0,0])
      else :
      x = math.atan2(-matrix[1, 2], matrix[1, 1])
      y = math.atan2(-matrix[2,0], sy)
      z = 0

      return [x, y, z]


      Or you can find the other solutions for other orders in:
      https://www.geometrictools.com/Documentation/EulerAngles.pdf



      But in the blog and in the PDF, they didn't mention which frame-of-reference they were using. So I am not sure, this solution is Global frame-of-reference or Local frame-of-reference of the rotation.







      python rotation euler-angles






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 12:32









      Zoe

      10.4k73575




      10.4k73575










      asked Nov 11 at 0:41









      Colin Ji

      513314




      513314





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: 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
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244826%2fis-it-the-global-frame-of-reference-or-local-frame-of-reference-of-the-rotation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244826%2fis-it-the-global-frame-of-reference-or-local-frame-of-reference-of-the-rotation%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

          Full-time equivalent

          Bicuculline

          さくらももこ