Packing circles in a rectangular domain with a touch-and-stop model of growth (contact inhibition)

This MATLAB algorithm allows you to pack <i>n</i> circles in a rectangular domain (see sample images).<div>The void ratio (i.e., amount of empty space in the rectangle) is user-defined and met precisely.<br><div><br></div><div>The domain has an arbitrary size that you can choose. Other parameters are also available for you to tweak.</div><div><br></div><div>The position of all circles is randomised: this means that it is virtually impossible to obtain two packed domains that look the same.</div><div><br></div><div>As an example, it is possible to pack >60,000 circles to a void ratio of 15% in 230 s (i7 4790k, DDR3 RAM 2400 Mhz).</div></div><div><br></div><div>The algorithm works by seeding a starting population of tiny circles, which are grown until they touch another circle or a boundary of the domain. Once all circles have grown, a new generation of tiny circles are created and grown.</div><div>This is repeated until the required void ratio is met.</div><div>Results are displayed in a figure and saved in .mat format.</div><div><br></div><div>The code is thoroughly commented to allow easy understanding of the process.</div><div><br></div><div>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). </div><div>There is a link above that will show the citation information for this algorithm (DOI, authors, title).</div>