Image-based Circle Packing within a polygonal limit

Hi Everybody!

I’ve been researching about circle packing and now I am trying to put it in practice in a University architecture project.

I’m working with a script I took from two different forums I stumbled upon because I want to have a circle packed pattern through an image but within certain limits.

These are two posts by Daniel Piker’s I’ve found in this forum. Daniel if you see this post, please, help me! :stuck_out_tongue:

I used his script and tried to adapt it to an image based script but I now I can’t limit the circles inside my curve input (only the center points are inside i guess). I tried to use a collide button that was on Daniel’s script before but I can’t do it. Does anyone have the skills to do it?

Here is a screenshot of the script and geometry, the rhino file and the gh file.
Thank you in advance!



Parametric_circle_filling_pattern_Image_based3.gh (2.6 MB)
Image_based_circle_packing.3dm (251.2 KB)
Base image

If you want the radii of the circles to update as they move around the image, you’ll need a different goal.
Luckily there is now a component to do exactly this, including the option to prescribe a tangent boundary:
https://github.com/Dan-Piker/Kangaroo-examples/blob/master/collisions_and_packing/Image_circlepacking.gh

You can see also some further discussion about variations on this for if you want a compact circle packing where each gap is surrounded by 3 circles:

https://discourse.mcneel.com/t/circle-packing-in-enclosed-boundary-unwanted-overlap/80292/6?u=danielpiker

7 Likes

Thank you Daniel, you’re the man! Seriously, I really appreciate it, I still can’t believe you found this post eheh. This new feature simplifies everything!!
Only now my Solver isn’t working, It’s probably easy to solve, I guess I’m not so good at this… Is it missing something? I think I connected every thing right.


Image_circlepacking2.gh (13.2 KB)
Image_circlepacking2.3dm (1.3 MB)

Okay I think I’ve got it, I moved the hole thing up the origin and it worked, thank you again Daniel!

1 Like

Please
Can you help me understand betterthe example?
Thank you

Hi @claudiofeldman,

Did you manage to set the image?
Image_circlepacking_filepath.gh (14.5 KB)

Here I’ve used a square image to keep things simple.
It works best with images which have a good range of brightness.

3 Likes

Yes, finally i do it.
Thank you for your help.
__ Then I was trying to get a Voronoi from a Portrait, to send to lasercut. (For some reason, it had complicated me, but yes, actually attaching the image was not that difficult). I have been following this tutorial and Delrieu’s as well. __

Grateful.

Greetings

hello Daniel,
I was looking at the gh file, the diferent radius circles (the rhino image)
It is so intresting!!!
but how can you change the image and use another one insted of the rhino.
There is no image sampler in the script!
The input seems to be a geometry, but the cirrcle are positioned based on an image???
Please can you tell me how to use the same script for another image?
Thank you !|

Hi @erion5k

See this post above

There’s no way to internalize an image file in a grasshopper document, so in the first example I internalised the coloured mesh.
The file in the post I just linked shows how to create a coloured mesh from an image file, but you’ll need to reference an image file from your own computer.

ok, thank you very much Daniel,
this one is easier to change the pic.

1 Like

Hello Daniel,

Is it possible to apply circle packing algortihm to zombie solver? I tried but I got only center of circles that are distributed in a different way.

Hi @Bojan_T

Try this:
Image_circlepacking_zombiedemo.gh (132.1 KB)

2 Likes

It works, thank you !


Hi @DanielPiker, i was trying my best to get an exact circle packing as you did with the phone case, i tried to recreate it as kind of a wallpaper, but it didn’t work out as i hoped, so here i am…
I don’t know if having sharp edges could be a problem here or if its in general hard for the algorithm to detect the cutout windows as part of the boundary?
Could you take a look and tell me what is wrong in the script?

Best regards

Jo
Wallpaper_exact_circlepacking_attempt.gh (1.2 MB)