According to wikipedia, sphere packing “concerns arrangements of non-overlapping identical spheres which fill a space”. A classic problem in mathematics and computational geometry, sphere packing can be regular (where the centers of the spheres form a symmetrical lattice) or aperiodic. While regular packing can be of some interest, aperiodic configurations can yield some extremely complex and interesting results, that are worth studying…
You can find a simple sphere packing algorithm implemented in maxscript here. However, in my way to create the algorithm, I made a small mistake; I forgot the obvious: to check that the created sphere was actually inside the volume that I was trying to pack. Which gave some very interesting result, as seen in the second image, that resemble a ‘sphere growth process’. Mistakes in scripting are usually annoying (especially if you can not find them) but sometimes are the best way to discover new directions. This second version of the script is here. The two versions of the code are almost identical; one conditional less for the ‘growth’ option. The last two images show triangles created between the centers of the spheres.
You can find a simple sphere packing algorithm implemented in maxscript here. However, in my way to create the algorithm, I made a small mistake; I forgot the obvious: to check that the created sphere was actually inside the volume that I was trying to pack. Which gave some very interesting result, as seen in the second image, that resemble a ‘sphere growth process’. Mistakes in scripting are usually annoying (especially if you can not find them) but sometimes are the best way to discover new directions. This second version of the script is here. The two versions of the code are almost identical; one conditional less for the ‘growth’ option. The last two images show triangles created between the centers of the spheres.