Skip to content

Instantly share code, notes, and snippets.

@doowb
Created May 30, 2014 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doowb/42c696b266870164de18 to your computer and use it in GitHub Desktop.
Save doowb/42c696b266870164de18 to your computer and use it in GitHub Desktop.
Radius from Area
var radius = function (area) {
// make the area bigger so we get better values for small areas
area = area * 10000;
// a = PI*r^2 => a/PI = r^2 => sqrt(a/PI) = r
return Math.ceil(Math.sqrt(area/Math.PI));
};
var r = radius(21000);
var d = r*2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment