i have an urgent question regarding circle packing, i’m trying to pack a set of circles with fixed radius (this part has been solved) however, now i’m trying to add another criteria into the script by having a fixed number of circles for each radius ( ie. 100 circles for radius A, 50 circles for radius B, and 20 circles for radius C) packed into a defined boundary.
any help is greatly appreciated.
I have uploaded my script for circle packing with fixed radius, hopefully someone can add some insights into how this could be accomplished. KangarooCPmultiradii.gh (14.5 KB)
You were not very far from the answer !!! Don’t forget to change the seeds of Random component in order to have differents points location, it is the reason of 255 and 25799778. But you can put 1, 2, 3 !!!
yes if you seek a bit there are some examples on this forum and on www.grasshopper3d.com Kingfisher Quilling
But if you seek to put 5 different sizes there are some variables, which are the number of each species, or ratio of species. Do you want a packing with gravity …
Forgot to mention - When making this I noticed a small error causing an instability in the collisions component, so the definition above includes a scripted fix for this. When you first open it, you’ll be prompted to set the location of the referenced file and will need to tell it where your copy of KangarooSolver.dll is.
As always wonderful results @DanielPiker. And thanks for all the good examples. I use also a lot MeshMachineStatic.
I had just some difficulties finding the location of solver on my PC with Rhino 6.0
C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Components
Here’s a version showing how you can have more different sizes.
I think it would be a pretty hard problem to find a global optimum for (in terms of minimum radii for the outer circle for a given set of circles inside), but I noticed you can often improve the packing by shrinking down the outer radius to give them a squeeze so they all overlap slightly, then bring it back up to a point where they are tangent again.
I found it interesting how if you keep doing this, it tends to push the smaller circles towards the middle.
I was playing around with this yesterday but didn’t get it to work satisfactorily - definitely @DanielPiker’s version is much better!
In case anyone’s interested though: circle-in-circle-packing.gh (22.2 KB)
( requires quite a lot of manual tweaking and dragging points about… really should get around to learning custom Kangaroo goal scripting )
Thanks for sharing - I prefer this way of controlling the numbers and radii.
By the way - the problem I found with the collisions component was that when one object was involved in multiple collisions, the vectors were being summed, but to keep it stable in the new solver what really needed to happen was for these vectors to be averaged.
With a few small changes it was possible to use this to simulate granular convection, sometimes called the ‘Brazil nut effect’ - the tendency of larger particles to rise to the top when their container is shaken, such as Brazil nuts in a box of muesli!
Great work.
Interestingly enough, this shaking principle is the operational principle for an ultrasonic particle sorter, used to sort very fine grades of abrasives (in the 600 to 50,000 mesh range), pharmaceutical particles,
Which leads to the thought, this could be used to study soil liquification during disturbance events, for example a seismic event. The vertical load (y) in your script could be reduced by effective buoyancy due to ground water, particle to particle cohesion could be modeled, containment pressure could also be added.
Great work.
Because you’re using Rhino 6, make sure to reference the copy of the DLL in the Rhino folder (Program Files>Rhino6>Plug-ins>Grasshopper>Components), not the one in the roaming grasshopper libraries folder.
I am having this issue at the moment, i have relinked the KangarooSolver but this still comes up. I am still getting to know Grasshopper altogether forgive me !