Skip to content

Instantly share code, notes, and snippets.

@StlTenny
Created April 4, 2012 19:19
Show Gist options
  • Save StlTenny/2304886 to your computer and use it in GitHub Desktop.
Save StlTenny/2304886 to your computer and use it in GitHub Desktop.
Circle Packing Problem
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