# Circle packing on surfaces

circle packing solution.gh (26.7 KB) circle packing solution.3dm (327.9 KB)

Hi @DanielPiker and all the community , I will ask you to help me in these definitions that I made … I am a beginner …
1st wish: how can I force the circles on the edge of the Brep to collide as in solution 1?
2nd wish: how can I add a circle one after the other to fill as in solution 1?
3rd wish: how can I put the larger circles in the center and the smaller ones near the edge when I have to regularize the packaging of the circle?

Here’s a way using the ImageCircles component.
This lets you use the colour of a mesh to specify what the radius of the circle should be at that point. Here I’ve shown it with this colour assigned by distance to the edge, but you could replace this with any other function you like. The sliders let you control the radii for black and white parts of the mesh, and it interpolates.
It also includes an optional curve input for a boundary to make them tangent to.
For adding circles one at a time, it should be possible to just slowly increase the Number slider.

circlePackingSizes_boundary.gh (96.7 KB)

3 Likes

Thank a lot @DanielPiker this is great!! now i can study this component…i’ll try to mix this solution with the others two…if this will be possible…

if i divide this model in half down the centre line then the circles pattern is different. Is it possible to make this more symmetrical - thanks.CP.3dm (159.1 KB)

Hi @KeithR,
Are you looking for a packing of circles with the same radius or varying?
One easy way to get a symmetrical arrangement is of course to pack the circles on half the shape then mirror it.
If you want some circles to actually lie on the mirror plane to avoid the seam though, they will need to be kept on the boundary, while the others are kept inside it.

Here’s an example with same sized circles, packing on one half, with some kept on the symmetry plane:

symmetric_circls.gh (33.7 KB)
You do have to set how many will be on the symmetry plane, and it can be a little bit of trial and error to find what works well for the number and radius of circles you have. I also find that to get a better arrangement it helps to move the radius slider up and down a bit, to encourage them to jiggle into a lower energy state. You could also use the Grab component to manually improve the packing.
With equal sized circles, it isn’t possible to have a compact circle packing with all 3 sided gaps. If that’s what you’re after it needs a different approach, like what I showed here: Circle Packing in Enclosed Boundary - Unwanted Overlap

2 Likes

Thanks @DanielPiker, which component sets the symmetry plane in this example? regards

The definition works with only half the surface right up until the final ‘Mirror’ component.
The Plane input to that Mirror component should be on the cut

Hi Daniel.

How would you achieve this without using symmetry?

Let’s say full surface, evenly distributed circles on the middle curve.

I evenly divided curve with divide curve & solve and tried to use those points as the anchors on the original, but can’t get it to work somehow…

I’m not sure I’m following -
Do you want an asymmetric packing of equal radius circles, with circles along some curve fixed?

I would like to have these circles anchored, not being affected by solver but affects other circles.