# Compact circle packing on complex surface

**URL:** <https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707>\
**Category:** Kangaroo\
**Tags:** windows, rhino6\
**Created:** [May 5, 2021, 4:29pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707 "2021-05-05T16:29:17Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![DanielPiker](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/danielpiker/32/666337_2.png) [@DanielPiker](https://discourse.mcneel.com/u/DanielPiker)\
**Post date:** [October 3, 2022, 6:24pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/22 "2022-10-03T18:24:10Z")

</div>

Ah yes, I think I see the problem. The script assumes a single boundary and tries to keep all naked vertices on that boundary curve, so when given multiple curves, it is pulling points from each mesh boundary curve to both target boundary curves.  
I’ll modify it to allow multiple boundaries.

---

<div class="post-metadata">

**Author:** ![DanielPiker](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/danielpiker/32/666337_2.png) [@DanielPiker](https://discourse.mcneel.com/u/DanielPiker)\
**Post date:** [October 4, 2022, 1:53pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/23 "2022-10-04T13:53:46Z")

</div>

Here’s a version that allows multiple boundary curves as input

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/0/5/f0522d3801a6ee95ba07be5dc4e2aef61a404b9e.png)  
[compactcircles\_multiboundary.gh](https://discourse.mcneel.com/uploads/short-url/tSeUDN8SJIB9JkTOcgI3rcUxYSl.gh) (18.9 KB)

Note that while there always exists a compact circle packing for a given connectivity graph within a single boundary curve, this is no longer true for multiple boundaries, so the circles generally cannot all be perfectly tangent.

---

<div class="post-metadata">

**Author:** ![emilien](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/emilien/32/554539_2.png) [@emilien](https://discourse.mcneel.com/u/emilien)\
**Post date:** [October 4, 2022, 2:42pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/24 "2022-10-04T14:42:50Z")

</div>

Works great !

 ![MeqNz5xKNM](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/3/8/93812dec2af73dc7eab1ceed99213ade96824e46.jpeg)  
Many thanks !

---

<div class="post-metadata">

**Author:** ![benedict](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/benedict/32/535424_2.png) [@benedict](https://discourse.mcneel.com/u/benedict)\
**Post date:** [October 4, 2022, 3:32pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/25 "2022-10-04T15:32:55Z")

</div>

yummy, thanks a lot!

---

<div class="post-metadata">

**Author:** ![Lizzie\_Higham](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lizzie_higham/32/451182_2.png) [@Lizzie\_Higham](https://discourse.mcneel.com/u/Lizzie_Higham)\
**Post date:** [March 23, 2023, 7:41pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/26 "2023-03-23T19:41:32Z")

</div>

Hello, does anyone know where to get Kangaroo 2 v2.5.3? Food4Rhino only seems to have up to Kangaroo 2.42 available and I would like to use the trimesh component but my grasshopper cannot find it,  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![wim](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/wim/32/747482_2.png) [@wim](https://discourse.mcneel.com/u/wim)\
**Post date:** [March 23, 2023, 7:48pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/27 "2023-03-23T19:48:10Z")

</div>

Hi Lizzie -

> [@Lizzie\_Higham](#):
>
> does anyone know where to get Kangaroo 2 v2.5.3?

Kangaroo 2 is a plug-in that ships as one of the factory-default plug-ins in Rhino 7. As long as your version of Rhino 7 is up-to-date, you’ll be using the latest version of Kangaroo 2 as well.

> [@Lizzie\_Higham](#):
>
> I would like to use the trimesh component but my grasshopper cannot find it,

The TriRemesh component can be found on the `Mesh` tab.  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/0/7/9076ecd95d7c233bc5470521e1a691b69f5a21af.png)

-wim

---

<div class="post-metadata">

**Author:** ![Lizzie\_Higham](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lizzie_higham/32/451182_2.png) [@Lizzie\_Higham](https://discourse.mcneel.com/u/Lizzie_Higham)\
**Post date:** [March 23, 2023, 8:02pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/28 "2023-03-23T20:02:13Z")

</div>

I see! I’ve been using Rhino6 so there’s the problem, many thanks!

---

<div class="post-metadata">

**Author:** ![Lizzie\_Higham](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lizzie_higham/32/451182_2.png) [@Lizzie\_Higham](https://discourse.mcneel.com/u/Lizzie_Higham)\
**Post date:** [March 23, 2023, 9:00pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/29 "2023-03-23T21:00:01Z")

</div>

Hello again! I’ve been working this into my script but I can’t quite understand where the range for circle size/radii is input as I would like to control this, is this possible? Where would a range or set of wanted radii be input if it is?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Nick\_Bruscia](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nick_bruscia/32/494620_2.png) [@Nick\_Bruscia](https://discourse.mcneel.com/u/Nick_Bruscia)\
**Post date:** [March 24, 2023, 9:10pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/30 "2023-03-24T21:10:04Z")

</div>

Hello Lizzie,  
You may want to share your file. I think there are a couple of ways to answer your question.  
If you’re using the Tangent Incircles goal, the circle sizes will be related to the triangle mesh faces which is what you’re optimizing in that case. Not sure if it’s possible to control this to achieve a desired set of incircle radii, but others can weigh in.  
If you’re using the Image Circles goal, there are inputs for max and min radii. But this will still produce alot of variation within that domain.  
It sounds like Sphere Collide is the better goal to use here. You might be able to assign specific radii to groups of points, and run the packing with them. This post has a file that may be a good place to start.

> [@Disk covering algorithm](https://discourse.mcneel.com/t/disk-covering-algorithm/125627/4):
>
> Thank you for your answer. How does constraint work that circles are partially out of the target surface? Is this constraint is applied only for centres?

---

<div class="post-metadata">

**Author:** ![jasontgarwood](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jasontgarwood/32/514056_2.png) [@jasontgarwood](https://discourse.mcneel.com/u/jasontgarwood)\
**Post date:** [January 10, 2024, 9:52pm UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/31 "2024-01-10T21:52:36Z")

</div>

Hi everyone, I’m still working on a similar problem here: [Compact circle packing with a set radii range on a trimmed 3D surface](https://discourse.mcneel.com/t/compact-circle-packing-with-a-set-radii-range-on-a-trimmed-3d-surface/173059)

---

<div class="post-metadata">

**Author:** ![jin2](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jin2/32/547909_2.png) [@jin2](https://discourse.mcneel.com/u/jin2)\
**Post date:** [February 18, 2024, 10:41am UTC](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707/32 "2024-02-18T10:41:35Z")

</div>

hi Daniel,Is it possible to control the radius of the circle to be the same?

[Previous page](https://discourse.mcneel.com/t/compact-circle-packing-on-complex-surface/123707.md?page=1)
