title: difficulty calculating angle of a point on a circle
body: <p>I'm having a bit of trouble with the geometry for a function I'm writing. I have a class that contains various sprites. This container class needs to be able to move, rotate, and scale while keeping all the child sprite's relative position, rotation, and scale intact.</p>
  
  <p>I'm running into issues when rotating the container. The angle calculated by atan2 seems to be random. I wrote a simple console application that does and outputs the math behind a function I'm using (it's hard to properly show the code, as it relies on various outside sources). I did this to make sure it wasn't another part of the code causing my error. But my results are the same with the console application. Here is the code (it's stand-alone. you can easily run it)</p>
  
  <pre><code>#include&lt;math.h&gt;
  #include&lt;iostream&gt;
  
  using namespace std;
  
    int main()
      {
          float containerX = 0;
          float containerY = 0;
  
          float childX = 10;
          float childY = 0;
  
          for(int i = 0; i &lt;= 360; i += 36)
          {
              float radius = sqrt(pow(containerX - childX, 2) + pow(containerY - childY, 2));
              float angle = atan2 (containerY - childY, containerX - childX);
  
              float newAngle = angle + (i / 180.0 * 3.14);
  
              childX = containerX + radius * cos(newAngle);
              childY = containerY + radius * sin(newAngle);
  
              std::cout &lt;&lt; "New angle: " &lt;&lt; newAngle * 180.0 / 3.14 &lt;&lt; " New Position: " &lt;&lt; childX &lt;&lt; ", " &lt;&lt; childY &lt;&lt; std::endl;
  
          }
  
          while(1!=2) {} // This line is so I can read the console output
  
          return 0;
      }
  </code></pre>
  
  <p>My output is as follows:</p>
  
  <pre><code>New angle: 180.091 New Position: -10, -8.74228e-007
  New angle: 36 New Position: 8.09204, 5.87528
  New angle: -72.0913 New Position: 3.08108, -9.51351
  New angle: 216 New Position: -8.10139, -5.86238
  New angle: 179.909 New Position: -9.99995, 0.0318542
  New angle: 179.817 New Position: -9.99988, 0.0477804
  New angle: 215.726 New Position: -8.12931, -5.8236
  New angle: 287.635 New Position: 3.00522, -9.53775
  New angle: 395.543 New Position: 8.15704, 5.78469
  New angle: 179.27 New Position: -9.99897, 0.143339
  New angle: 359.178 New Position: 9.99846, -0.175189
  </code></pre>
  
  <p>I know that the problem has something to do with me calculating the angle with atan2, since if I just convert i to radians (i is iterating through degrees 0 and 360 in increments of 36) and pass that to cos and sin, I get points in order around the circle. If I use my "newAngle" variable though, I get random points around the circumference of the circle (bottom left, rop right, near bottom left, left of circle, right of circle, etc)</p>
  
  <p>Thanks for reading this. I really appreciate it. I'm totally stuck. Any help would be wonderful.</p>