Angle between vector and x-axis in specific intervals












0












$begingroup$


Given a vector going from a point $(x_0,y_0)$ to $(x_1,y_1)$ in a regular 2D-plane (i.e. an $hat{x}$-axis pointing right and a $hat{y}$-axis pointing up), I want to determine the angle between the vector and the $hat{x}$-axis.



When the vector is in the first and second quadrant, the angle should be between $[0,-pi]$, and between $[0,pi]$ when it is in the third and forth quadrant. To clarify, a vector pointing in positive and negative $hat{y}$-direction should have angle $-frac{pi}{2}$ and $frac{pi}{2}$, respectively.



What is the expression for the angle?










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    Given a vector going from a point $(x_0,y_0)$ to $(x_1,y_1)$ in a regular 2D-plane (i.e. an $hat{x}$-axis pointing right and a $hat{y}$-axis pointing up), I want to determine the angle between the vector and the $hat{x}$-axis.



    When the vector is in the first and second quadrant, the angle should be between $[0,-pi]$, and between $[0,pi]$ when it is in the third and forth quadrant. To clarify, a vector pointing in positive and negative $hat{y}$-direction should have angle $-frac{pi}{2}$ and $frac{pi}{2}$, respectively.



    What is the expression for the angle?










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      Given a vector going from a point $(x_0,y_0)$ to $(x_1,y_1)$ in a regular 2D-plane (i.e. an $hat{x}$-axis pointing right and a $hat{y}$-axis pointing up), I want to determine the angle between the vector and the $hat{x}$-axis.



      When the vector is in the first and second quadrant, the angle should be between $[0,-pi]$, and between $[0,pi]$ when it is in the third and forth quadrant. To clarify, a vector pointing in positive and negative $hat{y}$-direction should have angle $-frac{pi}{2}$ and $frac{pi}{2}$, respectively.



      What is the expression for the angle?










      share|cite|improve this question









      $endgroup$




      Given a vector going from a point $(x_0,y_0)$ to $(x_1,y_1)$ in a regular 2D-plane (i.e. an $hat{x}$-axis pointing right and a $hat{y}$-axis pointing up), I want to determine the angle between the vector and the $hat{x}$-axis.



      When the vector is in the first and second quadrant, the angle should be between $[0,-pi]$, and between $[0,pi]$ when it is in the third and forth quadrant. To clarify, a vector pointing in positive and negative $hat{y}$-direction should have angle $-frac{pi}{2}$ and $frac{pi}{2}$, respectively.



      What is the expression for the angle?







      angle






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Jan 9 at 14:35









      ryekosryekos

      204




      204






















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          The angle from the vector to the $x$ axis is equal to minus of the angle between the $x$ axis and the vector. You have for this second angle $$tantheta=frac{y_1-y_0}{x_1-x_0}$$
          The first guess would be to use the arctangent. Notice that if you take the ratio, you cannot distinguish between angles in quadrants $2$ and $4$, or between angles in quadrants $1$ and $3$. For many computer programming languages, there is a function called $rm{atan2}$ or $rm{arctan2}$. The arguments are $y_1-y_0$ and $x_1-x_0$. You can find a formal description on wikipedia.






          share|cite|improve this answer









          $endgroup$














            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%2f3067509%2fangle-between-vector-and-x-axis-in-specific-intervals%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1












            $begingroup$

            The angle from the vector to the $x$ axis is equal to minus of the angle between the $x$ axis and the vector. You have for this second angle $$tantheta=frac{y_1-y_0}{x_1-x_0}$$
            The first guess would be to use the arctangent. Notice that if you take the ratio, you cannot distinguish between angles in quadrants $2$ and $4$, or between angles in quadrants $1$ and $3$. For many computer programming languages, there is a function called $rm{atan2}$ or $rm{arctan2}$. The arguments are $y_1-y_0$ and $x_1-x_0$. You can find a formal description on wikipedia.






            share|cite|improve this answer









            $endgroup$


















              1












              $begingroup$

              The angle from the vector to the $x$ axis is equal to minus of the angle between the $x$ axis and the vector. You have for this second angle $$tantheta=frac{y_1-y_0}{x_1-x_0}$$
              The first guess would be to use the arctangent. Notice that if you take the ratio, you cannot distinguish between angles in quadrants $2$ and $4$, or between angles in quadrants $1$ and $3$. For many computer programming languages, there is a function called $rm{atan2}$ or $rm{arctan2}$. The arguments are $y_1-y_0$ and $x_1-x_0$. You can find a formal description on wikipedia.






              share|cite|improve this answer









              $endgroup$
















                1












                1








                1





                $begingroup$

                The angle from the vector to the $x$ axis is equal to minus of the angle between the $x$ axis and the vector. You have for this second angle $$tantheta=frac{y_1-y_0}{x_1-x_0}$$
                The first guess would be to use the arctangent. Notice that if you take the ratio, you cannot distinguish between angles in quadrants $2$ and $4$, or between angles in quadrants $1$ and $3$. For many computer programming languages, there is a function called $rm{atan2}$ or $rm{arctan2}$. The arguments are $y_1-y_0$ and $x_1-x_0$. You can find a formal description on wikipedia.






                share|cite|improve this answer









                $endgroup$



                The angle from the vector to the $x$ axis is equal to minus of the angle between the $x$ axis and the vector. You have for this second angle $$tantheta=frac{y_1-y_0}{x_1-x_0}$$
                The first guess would be to use the arctangent. Notice that if you take the ratio, you cannot distinguish between angles in quadrants $2$ and $4$, or between angles in quadrants $1$ and $3$. For many computer programming languages, there is a function called $rm{atan2}$ or $rm{arctan2}$. The arguments are $y_1-y_0$ and $x_1-x_0$. You can find a formal description on wikipedia.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Jan 9 at 15:31









                AndreiAndrei

                13.4k21230




                13.4k21230






























                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3067509%2fangle-between-vector-and-x-axis-in-specific-intervals%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

                    Cabo Verde

                    Karlovacs län

                    Gyllenstierna