Well good sir, I have tried and failed at doing math. Could you possibly point out and explain what is wrong? My planets are 240 in width and height, and I’ve tried my best to adjust all this math to fit that, but I just don’t fully understand it. I also wanted to create exactly 300 planets, but I ended up with 225 because again, I don’t understand this math at all. Many planets come close to intersecting or intersect, and so I would like a nice padding of at least 100 pixels which I’ve been trying to figure out how to do for the past 6 hours. Also, I’m using the Blue Noise method since its exactly the style of generation I was looking for.
for(int i = 0; i < 15 ; i++){
float x_min = -30000 + cellSize*i;
float x_max = -30000 + cellSize *(i+245);
x_min += 300;
x_max -= 300;
for(int j = 0; j < 15; j++){
float y_min = -30000 + cellSize*j;
float y_max = -30000 + cellSize *(j+245);
y_min += 300;
y_max -= 300;
planetList.add(new Planet(rand.nextInt( (int) ((x_max - x_min) + 1)) + x_min, rand.nextInt((int) (y_max - y_min) + 1) + y_min, PlanetSelect, planetWhiteRegion, planetGreenRegion, planetRedRegion));
}
}