title: How to find angle of point from x-axis independant of quadrant?
body: <p>Given a point (x,y), how do I calculate the angle from the x-axis?</p>
  
  <pre><code>        |    . &lt;- (x,y)
          |   /
          |  /
          | /
          |/
  --------+---------
          |
          |
  </code></pre>
  
  <p>Currently I have</p>
  
  <pre><code>Math.atan(y/x) * 180 / Math.PI;
  </code></pre>
  
  <p>However, this does not represent all the coordinates properly. Here are the results for this in each of the quadrants (counterclockwise).</p>
  
  <pre><code>Quadrant 1: 0 -&gt; -90
  Quadrant 2: 90 -&gt; 0
  Quadrant 3: 0 -&gt; -90
  Quadrant 4: 90 -&gt; 0
  </code></pre>
  
  <p>How can I write a statement that will give me the angle from the x-axis of any point such that the results for the quadrants look like this.</p>
  
  <pre><code>Quadrant 1: 0 -&gt; 90
  Quadrant 2: 90 -&gt; 180
  Quadrant 3: 180 -&gt; 270
  Quadrant 4: 270 -&gt; 360
  </code></pre>
  
  <p>Basically how do I make this work in all four quadrants?</p>