Created
April 4, 2012 19:19
-
-
Save StlTenny/2304886 to your computer and use it in GitHub Desktop.
Circle Packing Problem
This file contains hidden or 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
package googleApiBuilder; | |
public class ApiBuilderTrap { | |
public static void main(String args[]){ | |
String query = ""; | |
int x = -74008713; | |
int y = 40752459; | |
int yint = 40752459; | |
double efficiency = .9069; | |
int w = 38796; | |
int h = 65378; | |
double area = (double) w * h; | |
int constraint = 1000; | |
double areaOfCircle = (efficiency * area)/constraint; | |
int r = (int) Math.sqrt(areaOfCircle/Math.PI); | |
double slope = 0.713031236; | |
System.out.println("Area = " + area + "areaOfCircle = " + areaOfCircle + " radius = " + r); | |
for(int t = 0; t * r < h; t++){ | |
x = -74008713 + (r * (t % 2)) + (int) Math.floor((y-yint)/slope); | |
y += r; | |
for(int j = 0; j * r < w; j++){ | |
x += r; | |
System.out.println("x = " + x + " y = " + y); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment