# Circle Packing in Enclosed Boundary - Unwanted Overlap

Hi Daniel,
is there any .gh definition you can offer yet?

I see that you are latest commentor in this thread. Could you by any chance achieve this .gh?

@glowingkakao - what is it you’re trying to do?

Actually my problem is not even close to this tread, I was looking for any answers to the wrong place. I just created a new submission for my goal. If you can take a look, I would really appreciate that. Thank you.

Thank you very much for this example, while playing with this script I noticed that the compact packing have a higher chance to fail near sharp corners like near the “home button” this this particular shape, is that something unavoidable with or something which can be solved with a better connectivity mesh?

The boundary curve input for the compact circle packing goal keeps each of the outer circles of the packing touching this curve at a single point.

If you want some circles to touch the boundary at 2 points (so they nestle into the sharp corners), this needs another goal.
Here’s one I made which keeps a point at equal distance from a pair of curves. So if you identify the corners and the parts of the boundary either side, it can keep a circle touching the boundary on both.

circpack_corner.gh (14.9 KB)

Note though that once we pin some circles in the corners like this, no perfect compact circle packing with given connectivity generally exists. For that the points need to have the freedom to slide around the boundary.
Also - I realised that when using the boundary curve input for the circle packing goal, the orientation of the curve matters (as it uses the relation between the curve tangent and the mesh normal to keep the circles on the inside of the curve). For a future release I’ll try and make it detect the correct curve orientation automatically, but currently you might sometimes have to flip the curve.

4 Likes

Here’s a slight adjustment to the above definition to inset the surface before remeshing which helps the circles move less during the optimization.
circpack_corner_offset.gh (17.7 KB)

Tagging also @assistant.petercoffi , as I think this is also relevant to the other discussion here Compact circle packing on complex surface - #5 by assistant.petercoffi

9 Likes

Thank you for the helpful example, It appears that grasshopper component’s control over this problem is limited and I will need to go into the kangaroo API to gain a better understanding of the hidden variables of this problem, on a side note are there any publications you might suggest for learning more about compact circle packing or the inner workings of kangaroo? As a student I wish to study this subject further myself.

Hi @texasvodkas,
What is it you feel is currently missing from the Grasshopper component?
Is there some other circle packing issue you’re still trying to solve beyond what’s described above?

As I think I mentioned in another thread, I’m working on an update to the combined simultaneous remeshing/circle packing.

1 Like

Hi everyone! Seems like @DanielPiker would be a great resource. This might be simple, but looking for help in packing equal radii circles inside a curve. To get a better picture, the ultimate goal is to create contours of an object and then pack those contours with said circles. These guides would be used to make the original objects out of food cans (hence the equal radii restriction).

Seems doable?
Thank you!

The example here shows filling a boundary curve with equal sized circles.

If you’re stacking layers of cans, how much does it matter how they line up from layer to layer?

2 Likes

oh nice! taking a look later today. From layer to layer it wouldn’t matter too much, almost preferable if they didn’t actually, just slightly offset from previous layer for better ‘can resolution’

1 Like

Feels like I’m missing a step. I can’t get the tight packing…

EDIT: played around with strength of SC, and it was what I needed. Is there a way to make the ‘outer’ layer of circles always be tangent to the outside curve? Not a big deal, but just curious.

Hi @hazel224542
To fill the shape you need to increase the number of circles (the `N` input of `PopGeo`) and/or increase the slider going into the Radius `R` input (not the strength) of the SphereCollide `SC` component.

I see you are filling a shape with 2 boundary curves, so you need to make sure these are offsetting in the right direction. You may need to flip the direction of your input curve.

diskpack_offset2.gh (10.9 KB)

1 Like

At this point the only major hurdle left for my circle packing problem is more control over the size of circles other than the existing remeshing edge length input, which I think the combined methods you are working on can really help with, kangaroo itself is an amazing tool and I couldn’t really find any crucial component missing at the moment, I was really just trying to get a better understanding of what each factors contribute in this problem, the corner problem is a good example where the option of circle touching 2 point of the edge isn’t directly offered because like you mentioned it makes the packing less likely to work because the vertices cant move as freely.

circpack_corner_offset.gh (17.7 KB)

Hi Dear @DanielPiker . İ try this file.powerfull and succesfull work, but circles sizes auto or random size !!

İ couldnt find circle sizes setting . İ want my circle size list enter . Please can u change and add this .gh file ???
Thanx all works…

Hi Daniel,

I’m a beginner at both Rhino and Grasshopper, but I’m trying to circle pack a 2D contoured boundary for a project. I love what was done in the circle at the top left of this photo. How did you achieve it?

Once the original boundary curve is connceted,there would be gaps in the conors. How to improve this ？I cant modify the C# code by myself，so I need your help. Thanks. See picture below.

That’s what this definition is for

If you post your file with inputs internalised I’ll take a look.

circpack_corner(zhan).gh (28.9 KB)

Hi @DanielPiker teacher，I am learnling all the Circle-Packing discussions here. I modified your def (named circpack_corner.gh）for I want to assign the original boundary curve instead of the remeshed mash boundary cureve. All the things seems works beside the circles at the corners. I noticed that the there circles at the corners only touch one curve and there is gap between the circle and the other curve. Maybe there is sonething to do with the C# code but i am not capable to do the work. I was trying to achieve my goal by using kangaroo twice, but I cant find one sover for restricting the same distance between point&curves in Kangaroo.Thanks.