Convert direction vector to euler angles












1














How do I convert a direction vector to euler angles?



I need to change the position of a character's head in a Java program that I'm writing. The pose of the head uses euler angles. I know the direction vector that it needs to face to.










share|cite|improve this question






















  • A single direction vector does not fully define a 3D orientation. If you have all three direction vectors that define the coordinate system fixed to the character's head, and you know where you want two of those vectors to point instead, you can construct a rotation matrix that will relate those starting and ending coordinate systems. All possible sets of Euler angles for the rotation could be extracted from that matrix.
    – jnez71
    Mar 22 '17 at 18:15
















1














How do I convert a direction vector to euler angles?



I need to change the position of a character's head in a Java program that I'm writing. The pose of the head uses euler angles. I know the direction vector that it needs to face to.










share|cite|improve this question






















  • A single direction vector does not fully define a 3D orientation. If you have all three direction vectors that define the coordinate system fixed to the character's head, and you know where you want two of those vectors to point instead, you can construct a rotation matrix that will relate those starting and ending coordinate systems. All possible sets of Euler angles for the rotation could be extracted from that matrix.
    – jnez71
    Mar 22 '17 at 18:15














1












1








1


1





How do I convert a direction vector to euler angles?



I need to change the position of a character's head in a Java program that I'm writing. The pose of the head uses euler angles. I know the direction vector that it needs to face to.










share|cite|improve this question













How do I convert a direction vector to euler angles?



I need to change the position of a character's head in a Java program that I'm writing. The pose of the head uses euler angles. I know the direction vector that it needs to face to.







3d






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Apr 30 '16 at 19:00









Elite_Dragon1337

1314




1314












  • A single direction vector does not fully define a 3D orientation. If you have all three direction vectors that define the coordinate system fixed to the character's head, and you know where you want two of those vectors to point instead, you can construct a rotation matrix that will relate those starting and ending coordinate systems. All possible sets of Euler angles for the rotation could be extracted from that matrix.
    – jnez71
    Mar 22 '17 at 18:15


















  • A single direction vector does not fully define a 3D orientation. If you have all three direction vectors that define the coordinate system fixed to the character's head, and you know where you want two of those vectors to point instead, you can construct a rotation matrix that will relate those starting and ending coordinate systems. All possible sets of Euler angles for the rotation could be extracted from that matrix.
    – jnez71
    Mar 22 '17 at 18:15
















A single direction vector does not fully define a 3D orientation. If you have all three direction vectors that define the coordinate system fixed to the character's head, and you know where you want two of those vectors to point instead, you can construct a rotation matrix that will relate those starting and ending coordinate systems. All possible sets of Euler angles for the rotation could be extracted from that matrix.
– jnez71
Mar 22 '17 at 18:15




A single direction vector does not fully define a 3D orientation. If you have all three direction vectors that define the coordinate system fixed to the character's head, and you know where you want two of those vectors to point instead, you can construct a rotation matrix that will relate those starting and ending coordinate systems. All possible sets of Euler angles for the rotation could be extracted from that matrix.
– jnez71
Mar 22 '17 at 18:15










3 Answers
3






active

oldest

votes


















0














Since rotations do not commute, the order of the three rotations matters.



Two may suffice, but in general three will be given, based on rotating the neck around each of the three coordinate axes.



Are you sure that the Euler angles show the position of the head in global coordinates? Or (more common) merely in relation to the next joint down, which is in turn given relative to the joint before that, and so on?






share|cite|improve this answer





























    0














    Euler angles would traditionally be used to determine the rotations needed to establish the orientation of a three axis local coordinate system. For a single vector, the initial or un-rotated axis needs to be stated. The pose would have associated intrinsic vectors for its local coordinate system. One of them likely establishes the direction that the object is pointing. If it is the the X axis, then Euler rotations would rotate the X axis in the direction of the desired vector.



    Euler single axis-angle data can be determined from a cross product and angle between the two vectors.



    Three rotations are not required for a vector. Two rotations, one that establishes a pitch (or altitude) elevation angle, and another to rotate to an azimuth angle (or set a heading), can rotate vector and point it in the direction of another vector. Describing a direction with altitude elevation angle and azimuth is called "horizontal coordinates".






    share|cite|improve this answer































      0














      You need to know not just the direction you want the nose to point, but also the direction you want the ear to point (and I'm assuming you have typical orthonormal right-handed coordinate systems so that the third desired vector would be along the first cross product with the second). That will fully define the desired orientation of the head. With its direction vectors known, construct the rotation matrix by using the direction vectors as columns and then follow the formula here to extract your needed set of Euler angles from that matrix.



      A lot of these steps, to be done precisely, require exactly knowing the coordinate conventions of your program, so I cannot provide a detailed list of steps. Regardless, if you are working with 3D graphics, I can't stress enough how important it is for you to learn and understand how rotations are represented in mathematics.






      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',
        autoActivateHeartbeat: false,
        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
        },
        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%2f1765799%2fconvert-direction-vector-to-euler-angles%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        0














        Since rotations do not commute, the order of the three rotations matters.



        Two may suffice, but in general three will be given, based on rotating the neck around each of the three coordinate axes.



        Are you sure that the Euler angles show the position of the head in global coordinates? Or (more common) merely in relation to the next joint down, which is in turn given relative to the joint before that, and so on?






        share|cite|improve this answer


























          0














          Since rotations do not commute, the order of the three rotations matters.



          Two may suffice, but in general three will be given, based on rotating the neck around each of the three coordinate axes.



          Are you sure that the Euler angles show the position of the head in global coordinates? Or (more common) merely in relation to the next joint down, which is in turn given relative to the joint before that, and so on?






          share|cite|improve this answer
























            0












            0








            0






            Since rotations do not commute, the order of the three rotations matters.



            Two may suffice, but in general three will be given, based on rotating the neck around each of the three coordinate axes.



            Are you sure that the Euler angles show the position of the head in global coordinates? Or (more common) merely in relation to the next joint down, which is in turn given relative to the joint before that, and so on?






            share|cite|improve this answer












            Since rotations do not commute, the order of the three rotations matters.



            Two may suffice, but in general three will be given, based on rotating the neck around each of the three coordinate axes.



            Are you sure that the Euler angles show the position of the head in global coordinates? Or (more common) merely in relation to the next joint down, which is in turn given relative to the joint before that, and so on?







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jul 13 '16 at 17:50









            GEdgar

            61.5k267168




            61.5k267168























                0














                Euler angles would traditionally be used to determine the rotations needed to establish the orientation of a three axis local coordinate system. For a single vector, the initial or un-rotated axis needs to be stated. The pose would have associated intrinsic vectors for its local coordinate system. One of them likely establishes the direction that the object is pointing. If it is the the X axis, then Euler rotations would rotate the X axis in the direction of the desired vector.



                Euler single axis-angle data can be determined from a cross product and angle between the two vectors.



                Three rotations are not required for a vector. Two rotations, one that establishes a pitch (or altitude) elevation angle, and another to rotate to an azimuth angle (or set a heading), can rotate vector and point it in the direction of another vector. Describing a direction with altitude elevation angle and azimuth is called "horizontal coordinates".






                share|cite|improve this answer




























                  0














                  Euler angles would traditionally be used to determine the rotations needed to establish the orientation of a three axis local coordinate system. For a single vector, the initial or un-rotated axis needs to be stated. The pose would have associated intrinsic vectors for its local coordinate system. One of them likely establishes the direction that the object is pointing. If it is the the X axis, then Euler rotations would rotate the X axis in the direction of the desired vector.



                  Euler single axis-angle data can be determined from a cross product and angle between the two vectors.



                  Three rotations are not required for a vector. Two rotations, one that establishes a pitch (or altitude) elevation angle, and another to rotate to an azimuth angle (or set a heading), can rotate vector and point it in the direction of another vector. Describing a direction with altitude elevation angle and azimuth is called "horizontal coordinates".






                  share|cite|improve this answer


























                    0












                    0








                    0






                    Euler angles would traditionally be used to determine the rotations needed to establish the orientation of a three axis local coordinate system. For a single vector, the initial or un-rotated axis needs to be stated. The pose would have associated intrinsic vectors for its local coordinate system. One of them likely establishes the direction that the object is pointing. If it is the the X axis, then Euler rotations would rotate the X axis in the direction of the desired vector.



                    Euler single axis-angle data can be determined from a cross product and angle between the two vectors.



                    Three rotations are not required for a vector. Two rotations, one that establishes a pitch (or altitude) elevation angle, and another to rotate to an azimuth angle (or set a heading), can rotate vector and point it in the direction of another vector. Describing a direction with altitude elevation angle and azimuth is called "horizontal coordinates".






                    share|cite|improve this answer














                    Euler angles would traditionally be used to determine the rotations needed to establish the orientation of a three axis local coordinate system. For a single vector, the initial or un-rotated axis needs to be stated. The pose would have associated intrinsic vectors for its local coordinate system. One of them likely establishes the direction that the object is pointing. If it is the the X axis, then Euler rotations would rotate the X axis in the direction of the desired vector.



                    Euler single axis-angle data can be determined from a cross product and angle between the two vectors.



                    Three rotations are not required for a vector. Two rotations, one that establishes a pitch (or altitude) elevation angle, and another to rotate to an azimuth angle (or set a heading), can rotate vector and point it in the direction of another vector. Describing a direction with altitude elevation angle and azimuth is called "horizontal coordinates".







                    share|cite|improve this answer














                    share|cite|improve this answer



                    share|cite|improve this answer








                    edited Jul 13 '16 at 17:59

























                    answered Jul 13 '16 at 17:43









                    B. Young

                    11




                    11























                        0














                        You need to know not just the direction you want the nose to point, but also the direction you want the ear to point (and I'm assuming you have typical orthonormal right-handed coordinate systems so that the third desired vector would be along the first cross product with the second). That will fully define the desired orientation of the head. With its direction vectors known, construct the rotation matrix by using the direction vectors as columns and then follow the formula here to extract your needed set of Euler angles from that matrix.



                        A lot of these steps, to be done precisely, require exactly knowing the coordinate conventions of your program, so I cannot provide a detailed list of steps. Regardless, if you are working with 3D graphics, I can't stress enough how important it is for you to learn and understand how rotations are represented in mathematics.






                        share|cite|improve this answer


























                          0














                          You need to know not just the direction you want the nose to point, but also the direction you want the ear to point (and I'm assuming you have typical orthonormal right-handed coordinate systems so that the third desired vector would be along the first cross product with the second). That will fully define the desired orientation of the head. With its direction vectors known, construct the rotation matrix by using the direction vectors as columns and then follow the formula here to extract your needed set of Euler angles from that matrix.



                          A lot of these steps, to be done precisely, require exactly knowing the coordinate conventions of your program, so I cannot provide a detailed list of steps. Regardless, if you are working with 3D graphics, I can't stress enough how important it is for you to learn and understand how rotations are represented in mathematics.






                          share|cite|improve this answer
























                            0












                            0








                            0






                            You need to know not just the direction you want the nose to point, but also the direction you want the ear to point (and I'm assuming you have typical orthonormal right-handed coordinate systems so that the third desired vector would be along the first cross product with the second). That will fully define the desired orientation of the head. With its direction vectors known, construct the rotation matrix by using the direction vectors as columns and then follow the formula here to extract your needed set of Euler angles from that matrix.



                            A lot of these steps, to be done precisely, require exactly knowing the coordinate conventions of your program, so I cannot provide a detailed list of steps. Regardless, if you are working with 3D graphics, I can't stress enough how important it is for you to learn and understand how rotations are represented in mathematics.






                            share|cite|improve this answer












                            You need to know not just the direction you want the nose to point, but also the direction you want the ear to point (and I'm assuming you have typical orthonormal right-handed coordinate systems so that the third desired vector would be along the first cross product with the second). That will fully define the desired orientation of the head. With its direction vectors known, construct the rotation matrix by using the direction vectors as columns and then follow the formula here to extract your needed set of Euler angles from that matrix.



                            A lot of these steps, to be done precisely, require exactly knowing the coordinate conventions of your program, so I cannot provide a detailed list of steps. Regardless, if you are working with 3D graphics, I can't stress enough how important it is for you to learn and understand how rotations are represented in mathematics.







                            share|cite|improve this answer












                            share|cite|improve this answer



                            share|cite|improve this answer










                            answered Mar 22 '17 at 18:33









                            jnez71

                            2,291620




                            2,291620






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Mathematics Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                Use MathJax to format equations. MathJax reference.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1765799%2fconvert-direction-vector-to-euler-angles%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

                                Måne

                                Storängen

                                VLT Carioca