Calculating the angle towards the z axis given the orthographical angles in the xz and yz planes











up vote
1
down vote

favorite












Please forgive my limited vocabulary, I'm not a math guru (yet) but I'm trying to solve a practical real-life challenge in a 3D scene I'm creating with PovRay.



Given a line going through x=0,y=0,z=0 in 3D Cartesian space.
I know the angles the line has on the xz plane and the yz plane as they would be when viewing them orthographically.
I want to know the angle that the line makes towards the z axis.



I came up with some known points, and an assumption:




  1. When xz=90° and yz=90° then the angle should be 0° (or 180° or 360°).

  2. When xz=0° and yz=0° then the angle should be 90° (or 270°).

  3. When xz=-90° and yz=-90° then the angle should be 0° again...

  4. When xz=45° and yz=0° then the angle should be 45° etc...


  5. My intuition says that xz=45° and yz=45° should be more than 45°. Slicing a cube from corner to opposite corner, so probably 180 - (inverse tan(0.5/1)) = 153.43°. Not sure if I have that correct though.



I could lay out the known values in a spreadsheet and try to brew a formula averaging the two angles and using a sinus or cosinus to wobble between the extremes, but I'd never know if the intermediate answers would actually be correct. Things also get tricky when x and y go different, I'm not sure where to start, summing them, taking an average or what.



At this point my brain starts running into digression mode, where I cannot concentrate or remember the last step taken... I'm not sure if it's a subconscious panic reaction but it bothers me. Seems like a barrier that prevents me from being as smart as Pythagoras was... How did he overcome that, sorry...



For now I just need a formula, but if someone could add some enlightenment (enable me to reason the formula on my own) that would be super!










share|cite|improve this question







New contributor




Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    1
    down vote

    favorite












    Please forgive my limited vocabulary, I'm not a math guru (yet) but I'm trying to solve a practical real-life challenge in a 3D scene I'm creating with PovRay.



    Given a line going through x=0,y=0,z=0 in 3D Cartesian space.
    I know the angles the line has on the xz plane and the yz plane as they would be when viewing them orthographically.
    I want to know the angle that the line makes towards the z axis.



    I came up with some known points, and an assumption:




    1. When xz=90° and yz=90° then the angle should be 0° (or 180° or 360°).

    2. When xz=0° and yz=0° then the angle should be 90° (or 270°).

    3. When xz=-90° and yz=-90° then the angle should be 0° again...

    4. When xz=45° and yz=0° then the angle should be 45° etc...


    5. My intuition says that xz=45° and yz=45° should be more than 45°. Slicing a cube from corner to opposite corner, so probably 180 - (inverse tan(0.5/1)) = 153.43°. Not sure if I have that correct though.



    I could lay out the known values in a spreadsheet and try to brew a formula averaging the two angles and using a sinus or cosinus to wobble between the extremes, but I'd never know if the intermediate answers would actually be correct. Things also get tricky when x and y go different, I'm not sure where to start, summing them, taking an average or what.



    At this point my brain starts running into digression mode, where I cannot concentrate or remember the last step taken... I'm not sure if it's a subconscious panic reaction but it bothers me. Seems like a barrier that prevents me from being as smart as Pythagoras was... How did he overcome that, sorry...



    For now I just need a formula, but if someone could add some enlightenment (enable me to reason the formula on my own) that would be super!










    share|cite|improve this question







    New contributor




    Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Please forgive my limited vocabulary, I'm not a math guru (yet) but I'm trying to solve a practical real-life challenge in a 3D scene I'm creating with PovRay.



      Given a line going through x=0,y=0,z=0 in 3D Cartesian space.
      I know the angles the line has on the xz plane and the yz plane as they would be when viewing them orthographically.
      I want to know the angle that the line makes towards the z axis.



      I came up with some known points, and an assumption:




      1. When xz=90° and yz=90° then the angle should be 0° (or 180° or 360°).

      2. When xz=0° and yz=0° then the angle should be 90° (or 270°).

      3. When xz=-90° and yz=-90° then the angle should be 0° again...

      4. When xz=45° and yz=0° then the angle should be 45° etc...


      5. My intuition says that xz=45° and yz=45° should be more than 45°. Slicing a cube from corner to opposite corner, so probably 180 - (inverse tan(0.5/1)) = 153.43°. Not sure if I have that correct though.



      I could lay out the known values in a spreadsheet and try to brew a formula averaging the two angles and using a sinus or cosinus to wobble between the extremes, but I'd never know if the intermediate answers would actually be correct. Things also get tricky when x and y go different, I'm not sure where to start, summing them, taking an average or what.



      At this point my brain starts running into digression mode, where I cannot concentrate or remember the last step taken... I'm not sure if it's a subconscious panic reaction but it bothers me. Seems like a barrier that prevents me from being as smart as Pythagoras was... How did he overcome that, sorry...



      For now I just need a formula, but if someone could add some enlightenment (enable me to reason the formula on my own) that would be super!










      share|cite|improve this question







      New contributor




      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Please forgive my limited vocabulary, I'm not a math guru (yet) but I'm trying to solve a practical real-life challenge in a 3D scene I'm creating with PovRay.



      Given a line going through x=0,y=0,z=0 in 3D Cartesian space.
      I know the angles the line has on the xz plane and the yz plane as they would be when viewing them orthographically.
      I want to know the angle that the line makes towards the z axis.



      I came up with some known points, and an assumption:




      1. When xz=90° and yz=90° then the angle should be 0° (or 180° or 360°).

      2. When xz=0° and yz=0° then the angle should be 90° (or 270°).

      3. When xz=-90° and yz=-90° then the angle should be 0° again...

      4. When xz=45° and yz=0° then the angle should be 45° etc...


      5. My intuition says that xz=45° and yz=45° should be more than 45°. Slicing a cube from corner to opposite corner, so probably 180 - (inverse tan(0.5/1)) = 153.43°. Not sure if I have that correct though.



      I could lay out the known values in a spreadsheet and try to brew a formula averaging the two angles and using a sinus or cosinus to wobble between the extremes, but I'd never know if the intermediate answers would actually be correct. Things also get tricky when x and y go different, I'm not sure where to start, summing them, taking an average or what.



      At this point my brain starts running into digression mode, where I cannot concentrate or remember the last step taken... I'm not sure if it's a subconscious panic reaction but it bothers me. Seems like a barrier that prevents me from being as smart as Pythagoras was... How did he overcome that, sorry...



      For now I just need a formula, but if someone could add some enlightenment (enable me to reason the formula on my own) that would be super!







      trigonometry






      share|cite|improve this question







      New contributor




      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|cite|improve this question







      New contributor




      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|cite|improve this question




      share|cite|improve this question






      New contributor




      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 20 at 0:26









      Louis Somers

      1084




      1084




      New contributor




      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Louis Somers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          I suppose that when you project your line orthographically on the $x,z$ plane and measure the angle in that plane, you are measuring that angle from the $x$ axis;
          and likewise you measure the angle in the $y,z$ plane from the $y$ axis.



          You know the 3D line goes through $(0,0,0).$
          You can easily detect if the line is completely in the $x,y$ plane,
          $90$ degrees from the $z$ axis, and in that case you have a solution.



          So let's consider just the case where you have looked at the line
          and determined it does not lie in the $x,y$ plane.
          In that case the line passes through a point somewhere with the coordinates
          $(x_1, y_1, 1).$



          Projected on the $x,z$ plane, the line passes through $(0,0)$ and $(x_1,1),$
          so by making a right triangle with vertices at those two points and
          a third vertex at $(x_1,0),$ we can apply the definition of cotangent to this triangle to conclude that if $theta_{xz}$ is the angle at $(0,0)$
          then $cot theta_{xz} = x_1.$



          Note that $theta_{xz}$ is the angle you called "xz". So if you know that angle, you can just take its cotangent and you then know $x_1.$



          For similar reasons, if $theta_{yz}$ is the angle you called "yz" in the $y,z$ plane, then $cot theta_{yz} = y_1.$



          Now that you know the coordinates $x_1$ and $y_1,$ you can construct a right triangle with vertices at $(0,0,0),$ $(x_1, y_1, 1),$ and $(0,0, 1).$
          In this triangle, the angle at $(0,0, 1)$ is the right angle,
          the side from $(0,0,0)$ to $(x_1, y_1, 1)$ lies along your 3D line,
          and the side from $(0,0,0)$ to $(0,0, 1)$ lies along the $z$-axis.
          So the angle between your line and the $z$-axis is the angle at $(0,0,0)$ in this triangle.



          The two sides of this triangle that meet at $(0,0,0)$ have lengths $1$
          (the adjacent side)
          and $sqrt{x_1^2 + y_1^2 + 1}$ (the hypotenuse).
          The opposite side has length $sqrt{x_1^2 + y_1^2}.$
          You have several choices regarding which trigonometric formula to apply,
          but since you like the inverse tangent, and the tangent is
          "opposite divided by adjacent",
          you can say that your angle is
          $$ arctanleft(sqrt{x_1^2 + y_1^2}right)
          = arctanleft(sqrt{cot^2(theta_{xz}) + cot^2(theta_{yz})}right). $$






          share|cite|improve this answer





















          • Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
            – Louis Somers
            2 days ago











          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: 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
          });


          }
          });






          Louis Somers is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3005744%2fcalculating-the-angle-towards-the-z-axis-given-the-orthographical-angles-in-the%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








          up vote
          1
          down vote



          accepted










          I suppose that when you project your line orthographically on the $x,z$ plane and measure the angle in that plane, you are measuring that angle from the $x$ axis;
          and likewise you measure the angle in the $y,z$ plane from the $y$ axis.



          You know the 3D line goes through $(0,0,0).$
          You can easily detect if the line is completely in the $x,y$ plane,
          $90$ degrees from the $z$ axis, and in that case you have a solution.



          So let's consider just the case where you have looked at the line
          and determined it does not lie in the $x,y$ plane.
          In that case the line passes through a point somewhere with the coordinates
          $(x_1, y_1, 1).$



          Projected on the $x,z$ plane, the line passes through $(0,0)$ and $(x_1,1),$
          so by making a right triangle with vertices at those two points and
          a third vertex at $(x_1,0),$ we can apply the definition of cotangent to this triangle to conclude that if $theta_{xz}$ is the angle at $(0,0)$
          then $cot theta_{xz} = x_1.$



          Note that $theta_{xz}$ is the angle you called "xz". So if you know that angle, you can just take its cotangent and you then know $x_1.$



          For similar reasons, if $theta_{yz}$ is the angle you called "yz" in the $y,z$ plane, then $cot theta_{yz} = y_1.$



          Now that you know the coordinates $x_1$ and $y_1,$ you can construct a right triangle with vertices at $(0,0,0),$ $(x_1, y_1, 1),$ and $(0,0, 1).$
          In this triangle, the angle at $(0,0, 1)$ is the right angle,
          the side from $(0,0,0)$ to $(x_1, y_1, 1)$ lies along your 3D line,
          and the side from $(0,0,0)$ to $(0,0, 1)$ lies along the $z$-axis.
          So the angle between your line and the $z$-axis is the angle at $(0,0,0)$ in this triangle.



          The two sides of this triangle that meet at $(0,0,0)$ have lengths $1$
          (the adjacent side)
          and $sqrt{x_1^2 + y_1^2 + 1}$ (the hypotenuse).
          The opposite side has length $sqrt{x_1^2 + y_1^2}.$
          You have several choices regarding which trigonometric formula to apply,
          but since you like the inverse tangent, and the tangent is
          "opposite divided by adjacent",
          you can say that your angle is
          $$ arctanleft(sqrt{x_1^2 + y_1^2}right)
          = arctanleft(sqrt{cot^2(theta_{xz}) + cot^2(theta_{yz})}right). $$






          share|cite|improve this answer





















          • Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
            – Louis Somers
            2 days ago















          up vote
          1
          down vote



          accepted










          I suppose that when you project your line orthographically on the $x,z$ plane and measure the angle in that plane, you are measuring that angle from the $x$ axis;
          and likewise you measure the angle in the $y,z$ plane from the $y$ axis.



          You know the 3D line goes through $(0,0,0).$
          You can easily detect if the line is completely in the $x,y$ plane,
          $90$ degrees from the $z$ axis, and in that case you have a solution.



          So let's consider just the case where you have looked at the line
          and determined it does not lie in the $x,y$ plane.
          In that case the line passes through a point somewhere with the coordinates
          $(x_1, y_1, 1).$



          Projected on the $x,z$ plane, the line passes through $(0,0)$ and $(x_1,1),$
          so by making a right triangle with vertices at those two points and
          a third vertex at $(x_1,0),$ we can apply the definition of cotangent to this triangle to conclude that if $theta_{xz}$ is the angle at $(0,0)$
          then $cot theta_{xz} = x_1.$



          Note that $theta_{xz}$ is the angle you called "xz". So if you know that angle, you can just take its cotangent and you then know $x_1.$



          For similar reasons, if $theta_{yz}$ is the angle you called "yz" in the $y,z$ plane, then $cot theta_{yz} = y_1.$



          Now that you know the coordinates $x_1$ and $y_1,$ you can construct a right triangle with vertices at $(0,0,0),$ $(x_1, y_1, 1),$ and $(0,0, 1).$
          In this triangle, the angle at $(0,0, 1)$ is the right angle,
          the side from $(0,0,0)$ to $(x_1, y_1, 1)$ lies along your 3D line,
          and the side from $(0,0,0)$ to $(0,0, 1)$ lies along the $z$-axis.
          So the angle between your line and the $z$-axis is the angle at $(0,0,0)$ in this triangle.



          The two sides of this triangle that meet at $(0,0,0)$ have lengths $1$
          (the adjacent side)
          and $sqrt{x_1^2 + y_1^2 + 1}$ (the hypotenuse).
          The opposite side has length $sqrt{x_1^2 + y_1^2}.$
          You have several choices regarding which trigonometric formula to apply,
          but since you like the inverse tangent, and the tangent is
          "opposite divided by adjacent",
          you can say that your angle is
          $$ arctanleft(sqrt{x_1^2 + y_1^2}right)
          = arctanleft(sqrt{cot^2(theta_{xz}) + cot^2(theta_{yz})}right). $$






          share|cite|improve this answer





















          • Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
            – Louis Somers
            2 days ago













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          I suppose that when you project your line orthographically on the $x,z$ plane and measure the angle in that plane, you are measuring that angle from the $x$ axis;
          and likewise you measure the angle in the $y,z$ plane from the $y$ axis.



          You know the 3D line goes through $(0,0,0).$
          You can easily detect if the line is completely in the $x,y$ plane,
          $90$ degrees from the $z$ axis, and in that case you have a solution.



          So let's consider just the case where you have looked at the line
          and determined it does not lie in the $x,y$ plane.
          In that case the line passes through a point somewhere with the coordinates
          $(x_1, y_1, 1).$



          Projected on the $x,z$ plane, the line passes through $(0,0)$ and $(x_1,1),$
          so by making a right triangle with vertices at those two points and
          a third vertex at $(x_1,0),$ we can apply the definition of cotangent to this triangle to conclude that if $theta_{xz}$ is the angle at $(0,0)$
          then $cot theta_{xz} = x_1.$



          Note that $theta_{xz}$ is the angle you called "xz". So if you know that angle, you can just take its cotangent and you then know $x_1.$



          For similar reasons, if $theta_{yz}$ is the angle you called "yz" in the $y,z$ plane, then $cot theta_{yz} = y_1.$



          Now that you know the coordinates $x_1$ and $y_1,$ you can construct a right triangle with vertices at $(0,0,0),$ $(x_1, y_1, 1),$ and $(0,0, 1).$
          In this triangle, the angle at $(0,0, 1)$ is the right angle,
          the side from $(0,0,0)$ to $(x_1, y_1, 1)$ lies along your 3D line,
          and the side from $(0,0,0)$ to $(0,0, 1)$ lies along the $z$-axis.
          So the angle between your line and the $z$-axis is the angle at $(0,0,0)$ in this triangle.



          The two sides of this triangle that meet at $(0,0,0)$ have lengths $1$
          (the adjacent side)
          and $sqrt{x_1^2 + y_1^2 + 1}$ (the hypotenuse).
          The opposite side has length $sqrt{x_1^2 + y_1^2}.$
          You have several choices regarding which trigonometric formula to apply,
          but since you like the inverse tangent, and the tangent is
          "opposite divided by adjacent",
          you can say that your angle is
          $$ arctanleft(sqrt{x_1^2 + y_1^2}right)
          = arctanleft(sqrt{cot^2(theta_{xz}) + cot^2(theta_{yz})}right). $$






          share|cite|improve this answer












          I suppose that when you project your line orthographically on the $x,z$ plane and measure the angle in that plane, you are measuring that angle from the $x$ axis;
          and likewise you measure the angle in the $y,z$ plane from the $y$ axis.



          You know the 3D line goes through $(0,0,0).$
          You can easily detect if the line is completely in the $x,y$ plane,
          $90$ degrees from the $z$ axis, and in that case you have a solution.



          So let's consider just the case where you have looked at the line
          and determined it does not lie in the $x,y$ plane.
          In that case the line passes through a point somewhere with the coordinates
          $(x_1, y_1, 1).$



          Projected on the $x,z$ plane, the line passes through $(0,0)$ and $(x_1,1),$
          so by making a right triangle with vertices at those two points and
          a third vertex at $(x_1,0),$ we can apply the definition of cotangent to this triangle to conclude that if $theta_{xz}$ is the angle at $(0,0)$
          then $cot theta_{xz} = x_1.$



          Note that $theta_{xz}$ is the angle you called "xz". So if you know that angle, you can just take its cotangent and you then know $x_1.$



          For similar reasons, if $theta_{yz}$ is the angle you called "yz" in the $y,z$ plane, then $cot theta_{yz} = y_1.$



          Now that you know the coordinates $x_1$ and $y_1,$ you can construct a right triangle with vertices at $(0,0,0),$ $(x_1, y_1, 1),$ and $(0,0, 1).$
          In this triangle, the angle at $(0,0, 1)$ is the right angle,
          the side from $(0,0,0)$ to $(x_1, y_1, 1)$ lies along your 3D line,
          and the side from $(0,0,0)$ to $(0,0, 1)$ lies along the $z$-axis.
          So the angle between your line and the $z$-axis is the angle at $(0,0,0)$ in this triangle.



          The two sides of this triangle that meet at $(0,0,0)$ have lengths $1$
          (the adjacent side)
          and $sqrt{x_1^2 + y_1^2 + 1}$ (the hypotenuse).
          The opposite side has length $sqrt{x_1^2 + y_1^2}.$
          You have several choices regarding which trigonometric formula to apply,
          but since you like the inverse tangent, and the tangent is
          "opposite divided by adjacent",
          you can say that your angle is
          $$ arctanleft(sqrt{x_1^2 + y_1^2}right)
          = arctanleft(sqrt{cot^2(theta_{xz}) + cot^2(theta_{yz})}right). $$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Nov 20 at 0:58









          David K

          51.2k340113




          51.2k340113












          • Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
            – Louis Somers
            2 days ago


















          • Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
            – Louis Somers
            2 days ago
















          Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
          – Louis Somers
          2 days ago




          Wow, it's as simple as "locate the point at z=1 and make triangles..." why didn't i come up with that? Haha, thanks for unlocking my brain :-)
          – Louis Somers
          2 days ago










          Louis Somers is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          Louis Somers is a new contributor. Be nice, and check out our Code of Conduct.













          Louis Somers is a new contributor. Be nice, and check out our Code of Conduct.












          Louis Somers is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3005744%2fcalculating-the-angle-towards-the-z-axis-given-the-orthographical-angles-in-the%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

          To store a contact into the json file from server.js file using a class in NodeJS

          Redirect URL with Chrome Remote Debugging Android Devices

          Dieringhausen