algorithmic modeling for Rhino

Hello everyone,

I developed this definition starting from BallCluster.ghx (one of Kangaroo's example files),what I did is variable radius and variable repulsion forces(based on the variable radius).
I saw some Visual Basic components that does similar work but since I first tried Kangaroo I wanted to build a simulation of circle packing (something that looks like based on physical principle rather that algorithms math)



Download the definition


- The simulation make it a bit bouncing,(that is a bit annoying, any idea?):
- In terms of packing efficiency it does not give extremely reliable result
(often there are various gap between the circles), as the efficiency vary
related to the initial position of the circles;
- It works well with a maximum of 23-25 circles.(anyone has idea to improve this)


- It wont be difficult to transform it in 3D Cluster of balls of different diameters;
- It wont be difficult to add constrains in terms of fixed radius and centers of circles;


Click here if you want to see how I used it


Views: 5267

Replies to This Discussion

Nice work.

a few suggestions:

-In your definition the zero length springs are pulling the objects together, and the PLaw forces with CutOffs are keeping them apart. It works much better if you use them the other way around.

This way the attraction between distant circles becomes very small, allowing you to use many more. The springs are also more effective at stopping the circles overlapping.

-To reduce the bouncing, either increase the drag in the Kangaroo settings, or switch the solver method to Archimedes.

-Disabling the Planar Srf component during simulation will speed up calculation a bit.


The attached altered definition works fine with several hundred circles.

Regarding the gaps - with this type of circle packing, where you fix the radii of the circles beforehand, I think it will be very difficult to avoid having any gaps between the circles with more than 4 sides (and I'd guess that to get only 3 sided gaps will generally be impossible).

If having a denser packing is more important to you than the specific radii of the circles, then I'd suggest looking at some different methods where you actually adjust the circle radii during simulation.


Hi Daniel,


thanks for the changes, now it works much better! 

it would be nice to adjust the radii during the simulation, I may try that way !


thanks again!




I was wondering if it is possible to take the circle packing logic and then apply an attractor element to it, where you can begin to create a gradient as the smaller circles group around say a specific point and get larger as they move away.  I ask because I am trying to create a facade for a studio project that does something along these lines and as of yet have been unsuccessful in achieving what I am looking for.

Hi Daniel,

I have manage to adapt this definition to an image-field that defines the radii of the circles, but my main target is to optimize the radii for a better arrangement and population within the image-field allowing the radii to change and adapt during the simulation... some one posted in you tube a great video where they show this plus other interesting packing logic's....

here is the link:

any suggestions about to achieve similar results as image base/fighting for space....?



Iker, is there any chance you could share your definition for image-field variable radius circle packing, if you still have it?

hey daniel,

when i try to open your definition, there are some orange componants and it is not working. could you maybe have a look?

thnak you so much



Thank you so much for posting your definition! 
I too am getting a bunch of orange widgets that arent working.  It starts with the path mapper part of the definition.  Any suggestions as to how to overcome this? 
Also, this is working on a 2d plane.  does anyone know how to get the same logic to apply to 3d space?




hi daniel,

thanks for the definition !!

does exactly what i need. my only problem is, when changing a parameter or unplugging an input parameter, the calculation starts immidiately and takes a long time. would it be possible to integrate a button (like in kangaroo) to start the calculation at a certain time (after setting multiple parameters)

thanks in advance

Hey this definition looks very interresting. I installed the newest Kangoroo is it possible and i get a failure notice. is it possible to update it or to post a screnshot from the definition


can you please guide me.

i need to stack spheres in FCC packing formation within any given volume.

can it be acheived with kangaroo?







  • Add Photos
  • View All

© 2020   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service