Packing circles in a circular domain with a touch-and-stop model of growth (contact inhibition)
NOTE: An updated version of this work using R language is available at https://github.com/chiarelliandrea/touch-stop-packing
This MATLAB algorithm allows you to pack n circles in a circular domain (see sample images).
The void ratio (i.e., amount of empty space in the circular domain) is user-defined.
The domain has an arbitrary diameter that you can choose. Other parameters are also available for you to tweak.
The position of all circles is randomised: this means that it is virtually impossible to obtain two packed domains that look the same.
The algorithm works by seeding a starting population of very small circles, which are grown until they touch another circle or the boundary of the domain. Once all circles have grown, a new generation of circles are created and grown.
This is repeated until the required void ratio is met.
Results are displayed in a figure and saved in .mat format.
The code is commented to allow easy understanding of the process.
Please remember that if you use this algorithm, you should cite it (e.g., articles, theses) and, in any case, leave the attribution text (MIT license).