This demonstrates a circle (or general shape) packing algorithm discussed in a paper by
Paul Bourke entitled
Filling: A new algorithm for procedural creation of game assets
. The basic method is to start with a shape that has an area (a0),
then create additional shapes that have an area porportional to the starting area. The porportion
is defined by an infinite sequence that converges. An example sequence, and the one used in this example
is g(i) = a0 * (1 / ic)
, where c = the "coefficient"
metioned above, i = the ith shape, a0 is the area of the
initial shape, and g(i) is the area of the ith shape.
This demo was created by Ben (quillaja) using p5.js. If you find bugs or have questions, please contact him on github. The code is freely available at github as well.