How do you calculate the vertical angle from a 3d rotation matrix or a quaternion?

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











up vote
0
down vote

favorite












I've got the rotation matrix and quaternion of a mobile device. I'm trying to calculate the vertical angle from it. What I'm trying to get is for example 0° if the device is held in portrait mode and 90° in landscape mode.



Any help would be appreciated. I'm sorry if this was asked before, I don't have any experience with this and didn't really know what to search for.







share|cite|improve this question



















  • Try starting here.
    – amd
    Jul 19 at 22:11














up vote
0
down vote

favorite












I've got the rotation matrix and quaternion of a mobile device. I'm trying to calculate the vertical angle from it. What I'm trying to get is for example 0° if the device is held in portrait mode and 90° in landscape mode.



Any help would be appreciated. I'm sorry if this was asked before, I don't have any experience with this and didn't really know what to search for.







share|cite|improve this question



















  • Try starting here.
    – amd
    Jul 19 at 22:11












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've got the rotation matrix and quaternion of a mobile device. I'm trying to calculate the vertical angle from it. What I'm trying to get is for example 0° if the device is held in portrait mode and 90° in landscape mode.



Any help would be appreciated. I'm sorry if this was asked before, I don't have any experience with this and didn't really know what to search for.







share|cite|improve this question











I've got the rotation matrix and quaternion of a mobile device. I'm trying to calculate the vertical angle from it. What I'm trying to get is for example 0° if the device is held in portrait mode and 90° in landscape mode.



Any help would be appreciated. I'm sorry if this was asked before, I don't have any experience with this and didn't really know what to search for.









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









asked Jul 19 at 21:00









Janko

32




32











  • Try starting here.
    – amd
    Jul 19 at 22:11
















  • Try starting here.
    – amd
    Jul 19 at 22:11















Try starting here.
– amd
Jul 19 at 22:11




Try starting here.
– amd
Jul 19 at 22:11










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










There are many sign conventions associated with rotation matrices, quaternions, and Euler angles. It can get confusing.



But hopefully you just want the angle $theta$ between the space-fixed $z$-axis and the body-fixed $z'$-axis, and presumably your $3times3$ rotation matrix $mathbfA$ is defined such that $mathbfr'=mathbfAcdotmathbfr$ (or the same equation, but with the transpose of $mathbfA$). In that case $costheta=A_33$ because it is just the scalar product between the original, and rotated, $(0,0,1)$ vectors. So take the arccos of the $3,3$ element of the rotation matrix.



I advise you to double check that this makes sense for your definitions and coordinate systems!






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%2f2857042%2fhow-do-you-calculate-the-vertical-angle-from-a-3d-rotation-matrix-or-a-quaternio%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
    0
    down vote



    accepted










    There are many sign conventions associated with rotation matrices, quaternions, and Euler angles. It can get confusing.



    But hopefully you just want the angle $theta$ between the space-fixed $z$-axis and the body-fixed $z'$-axis, and presumably your $3times3$ rotation matrix $mathbfA$ is defined such that $mathbfr'=mathbfAcdotmathbfr$ (or the same equation, but with the transpose of $mathbfA$). In that case $costheta=A_33$ because it is just the scalar product between the original, and rotated, $(0,0,1)$ vectors. So take the arccos of the $3,3$ element of the rotation matrix.



    I advise you to double check that this makes sense for your definitions and coordinate systems!






    share|cite|improve this answer



























      up vote
      0
      down vote



      accepted










      There are many sign conventions associated with rotation matrices, quaternions, and Euler angles. It can get confusing.



      But hopefully you just want the angle $theta$ between the space-fixed $z$-axis and the body-fixed $z'$-axis, and presumably your $3times3$ rotation matrix $mathbfA$ is defined such that $mathbfr'=mathbfAcdotmathbfr$ (or the same equation, but with the transpose of $mathbfA$). In that case $costheta=A_33$ because it is just the scalar product between the original, and rotated, $(0,0,1)$ vectors. So take the arccos of the $3,3$ element of the rotation matrix.



      I advise you to double check that this makes sense for your definitions and coordinate systems!






      share|cite|improve this answer

























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        There are many sign conventions associated with rotation matrices, quaternions, and Euler angles. It can get confusing.



        But hopefully you just want the angle $theta$ between the space-fixed $z$-axis and the body-fixed $z'$-axis, and presumably your $3times3$ rotation matrix $mathbfA$ is defined such that $mathbfr'=mathbfAcdotmathbfr$ (or the same equation, but with the transpose of $mathbfA$). In that case $costheta=A_33$ because it is just the scalar product between the original, and rotated, $(0,0,1)$ vectors. So take the arccos of the $3,3$ element of the rotation matrix.



        I advise you to double check that this makes sense for your definitions and coordinate systems!






        share|cite|improve this answer















        There are many sign conventions associated with rotation matrices, quaternions, and Euler angles. It can get confusing.



        But hopefully you just want the angle $theta$ between the space-fixed $z$-axis and the body-fixed $z'$-axis, and presumably your $3times3$ rotation matrix $mathbfA$ is defined such that $mathbfr'=mathbfAcdotmathbfr$ (or the same equation, but with the transpose of $mathbfA$). In that case $costheta=A_33$ because it is just the scalar product between the original, and rotated, $(0,0,1)$ vectors. So take the arccos of the $3,3$ element of the rotation matrix.



        I advise you to double check that this makes sense for your definitions and coordinate systems!







        share|cite|improve this answer















        share|cite|improve this answer



        share|cite|improve this answer








        edited Jul 20 at 6:21


























        answered Jul 19 at 22:55









        LonelyProf

        1415




        1415






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2857042%2fhow-do-you-calculate-the-vertical-angle-from-a-3d-rotation-matrix-or-a-quaternio%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?