Created
May 30, 2014 19:09
-
-
Save doowb/42c696b266870164de18 to your computer and use it in GitHub Desktop.
Radius from Area
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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