

 Can someone help me improve the number_of_circles formula? - robinduckett
http://codepen.io/haxd/full/vGylJ

======
robinduckett
So I've got two functions, number_of_circles and number_of_circles_trig.

Neither are particularly accurate, and probably my misunderstanding of
trigonometry in this case causes it to be so.

I was never formally taught trig in school, so it'd be nice if someone could
find a better method and instruct me as to why it's more accurate than what I
have.

Here are my two functions:

    
    
        var number_of_circles = function(radius, radius2) {
          return Math.PI*(radius2+radius)/radius;
        };
        
        // slightly more accurate
        var number_of_circles_trig = function(radius, radius2) {
          var rad = Math.atan(radius / (radius+radius2))*2;
          var deg = rad * (180 / Math.PI);
          return (360 / deg);
        };

