Approximate radius of a group of n packed circles

272 Views Asked by At

I am looking for a formula to estimate the radius of a circle which would hold n number of circles with some radius r. I understand this is part of the packing problem which does not have a definite answer.

This will be used in a game I am programming and I want to calculate the size of a group of entities after they naturally pack themselves together in a quasi circle formation before the group is formed based on the number of entities to be grouped.

All I need is an estimation that I can put into practice.

1

There are 1 best solutions below

0
On

If a circle or radius $r$ is inscribed in a regular hexagon, the area of the hexagon is $2 \sqrt 3 r^2 \approx 3.4641 r^2.$ Your area is, at best, $2 n \sqrt 3 r^2. $ So, you want the radius $R$ of the circle that, more or less, encloses the little discs to solve $$ \pi R^2 = 2 n \sqrt 3 r^2, $$ or $$ R^2 = \left( \frac{2 n \sqrt 3}{\pi} \right) r^2, $$ finally $$ R = r \sqrt n \sqrt{ \left( \frac{2 \sqrt 3}{\pi} \right) } \approx 1.050075 \; r \; \sqrt n. $$

Would I lie?