title: How to map atan2() to degrees 0-360
body: <p><code>atan2(y, x)</code> has that discontinuity at 180° where it switches to -180°..0° going clockwise.</p>
  <p>How do I map the range of values to 0°..360°?</p>
  <p>here is my code:</p>
  <pre class="lang-c prettyprint-override"><code>CGSize deltaPoint = CGSizeMake(endPoint.x - startPoint.x, endPoint.y - startPoint.y);
  float swipeBearing = atan2f(deltaPoint.height, deltaPoint.width);
  </code></pre>
  <p>I'm calculating the direction of a swiping touch event given the <code>startPoint</code> and <code>endPoint</code>, both XY point structs. The code is for the iPhone but any language that supports <code>atan2f()</code> will do.</p>