Circle packing with fixed radius and fixed number of circle for each radius

unhandled
(Andy0604) #1

Hello guys,

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)

1 Like

Halftone like point pattern, geometrical problem
(Laurent Delrieu) #2

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 !!!

2 Likes

Circle packing
(Marcinfejcak) #3

Hi,do you have any ideas how to add a boundary circle to this script?

Thanks!
Marcin

0 Likes

(Laurent Delrieu) #4

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 …

2 Likes

(Daniel Piker) #5

Hi Marcin,
Here’s an updated version with Kangaroo2
circles_in_circle.gh (20.2 KB)

1 Like

(Daniel Piker) #6

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.

3 Likes

Hex grid with adaptive density
Fill a surface with circles using an attractor in the center
(Daniel Piker) #7

I’d missed that post - nice work!

0 Likes

(Laurent Delrieu) #8

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

0 Likes

(Daniel Piker) #9

circles_in_circle5sizes.gh (28.6 KB)

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.

6 Likes

(Marcinfejcak) #10

That’s insane! Guys thank you so much. @DanielPiker your script is perfect. I am extremely grateful for your help and your time.

0 Likes

(qythium) #11

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 :sweat_smile: )

1 Like

(Daniel Piker) #12

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.

0 Likes

(Daniel Piker) #13

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!

brazilnut.gh (30.2 KB)

12 Likes

#14

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.

0 Likes

(Tashheyes) #15

Hello
Amazing! do you need kanagaroo2 plugins to complete the script?

0 Likes

(Daniel Piker) #16

Yes, you’ll need a current version of kangaroo to run this definition. Rhino 6 includes this, or if on rhino 5 you can get the latest from food4rhino

0 Likes

(Adam Mounsey) #18

Very interested to take a look at this, but I get the following error message:

Error (CS0246): The type or namespace name ‘GoalObject’ could not be found (are you missing a using directive or an assembly reference?) (line 79)

I changed the assembly reference location for the KangarooSolver.dll, and made sure it was unblocked.

Any ideas?

Rhino Version 6 SR7

0 Likes

(Daniel Piker) #19

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.

0 Likes

(Adam Mounsey) #20

That solved it. Thanks.

0 Likes

(Tashheyes) #21


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 !

0 Likes