i have a rectangle of B x L meters and i want to know how many circles with R radius can fit if there is a space of D between them. All the values wil be integers always.
I tried this.
With this example:
i have: B = 10 L = 9
If radius of circles are R=1 and distance is 3 D=3. I can fit 4 circles (In the image they are the yellow zones)
So, for creating like a formula, i extended the radius of the circles to radius plus D between them, so the radius of the circles will be R + D/2. After that i calculate the area of a circle with that Radius
Grid with circles and extended radius with distance
With that area, i divided the area of the rectangle (10 x 9) between the area of the circle and cut the decimals, but the result is 2, not 4 :(
I dont know how to get to a valid formula. I'm not a mathematician, i would appreciate any help. Thanks :)
after reviewing the link that @hornypigeon54 provided me in the comment of the post, i saw the code that the page used to calculate the number of circles in the rectangle. After modyfing it a little, i came with this function in python to do that calculation. B and L are the dimensions of the rectangle, radius is the radius of the circles and the distance between them. So far the algorithm is working but i'm testing it.