# Closed curves packing

**URL:** <https://discourse.mcneel.com/t/closed-curves-packing/182242>\
**Category:** Kangaroo\
**Tags:** windows, python, rhino7, grasshopperrhino\
**Created:** [May 16, 2024, 9:28pm UTC](https://discourse.mcneel.com/t/closed-curves-packing/182242 "2024-05-16T21:28:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.Ralf](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mr.ralf/32/723813_2.png) [@Mr.Ralf](https://discourse.mcneel.com/u/Mr.Ralf)\
**Post date:** [May 16, 2024, 9:28pm UTC](https://discourse.mcneel.com/t/closed-curves-packing/182242/1 "2024-05-16T21:28:50Z")

</div>

Hello everyone,  
I’m working on packing closed curves inside a rectangle. Specifically, I want to pack curves that look like ellipses while controlling their aspect ratios and their distribution within the rectangle. I tried using a Grasshopper script designed for packing circles, but I haven’t been able to prevent the ellipses from intersecting. The picture below illustrates what I’m trying to achieve.

 ![CURVES PACKING](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/e/9/6e9870657a704a676fd4a83ea7962d3b50722a7d.jpeg)  
[CURVES PACKING.gh](https://discourse.mcneel.com/uploads/short-url/wJfWAuMNnIT2Csya1krsaHI04GX.gh) (33.8 KB)

---

<div class="post-metadata">

**Author:** ![laurent\_delrieu](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/laurent_delrieu/32/601605_2.png) [@laurent\_delrieu](https://discourse.mcneel.com/u/laurent_delrieu)\
**Post date:** [May 18, 2024, 9:57am UTC](https://discourse.mcneel.com/t/closed-curves-packing/182242/2 "2024-05-18T09:57:41Z")

</div>

Hello  
for what is worth my tool is not so bad, but is not nesting as objects cloud be duplicated and/or all objects are not used.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/e/4/5/e452d90b98b83e69f44518aa63d9debafda61a4c.jpeg)  
No rotation  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/7/7/1/771a2c54edffc1a67be9a80b8324cba3cdbbfe49.jpeg)  
[ellipsoid\_pack-MODIF\_LD.gh](https://discourse.mcneel.com/uploads/short-url/msYDvvD2wMmH84gXVtcCARQWcnn.gh) (13.3 KB)

> **[Nautilus](https://www.food4rhino.com/en/app/nautilus)**
>
> Various tools developed by Laurent Delrieu

Duplicate post with this one

> [@Help! Ellipses seamless pattern](https://discourse.mcneel.com/t/help-ellipses-seamless-pattern/132353/28):
>
> Dear @DanielPiker i admire your works and its so helpfull, so I’m working on packing closed curves inside a rectangle. Specifically, I want to pack curves that look like ellipses while controlling their aspect ratios and their distribution within the rectangle. I tried using your Grasshopper script, but still not yet able to do it is there any suggestions? [ellipsoid\_pack-MODIF.gh](https://discourse.mcneel.com/uploads/short-url/tIsoQmDHPLthAZy5KzHfOcR6plJ.gh) (13.5 KB)

Some others tests (resolution 1600 pixels, ~50 s calculation)  
RandomPlace = false  
Random object = true

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/d/b/8db6a3515e2175f4a0edf68dc3fc20b33a51689c.jpeg)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/0/f/80fc98b26eb84824773c7edf6929dd1d44ed3f07.png)  
RandomPlace = true  
Random object = true  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/5/a/a/5aa1b031db9edcaea1abc36625aead8edbe89f7f.jpeg)

No rotation  
RandomPlace = false  
Random object = false

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/1/c/8/1c811ad4fbbf3251728b0659603c38a8b35cba2a.jpeg)

generating 50 random ellipses and turning them by 90°  
RandomPlace = false  
Random object = false

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/b/c/3bc60aba20d53c38104f1537ddc3956ad7c50a2e.jpeg)  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/d/b/fdb23bbe440a4d8c8e1f32bd8a35a7812548a9e4.png)  
generating 50 random ellipses and turning them by 90° and 45°  
RandomPlace = false  
Random object = false  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/2/1/621ec6b5d388809f8c935a3db35ca3f7545b4630.jpeg)  
[ellipsoid\_pack-MODIF\_LD\_0\_45\_90deg.gh](https://discourse.mcneel.com/uploads/short-url/zQJq1pxbAA9ddjUcp4Dx3mYJduD.gh) (14.7 KB)

---

<div class="post-metadata">

**Author:** ![Mr.Ralf](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mr.ralf/32/723813_2.png) [@Mr.Ralf](https://discourse.mcneel.com/u/Mr.Ralf)\
**Post date:** [May 18, 2024, 8:42pm UTC](https://discourse.mcneel.com/t/closed-curves-packing/182242/3 "2024-05-18T20:42:35Z")

</div>

Dear @laurent_delrieu  
[MODIFIE.gh](https://discourse.mcneel.com/uploads/short-url/mZX2havixmONblmx2qtNjt3wcSJ.gh) (15.2 KB)

Your work is magnificent and has really helped me. I tried using the Grasshopper file you provided and made some modifications to get two lists of elliptical curves, each with a specific aspect ratio. However, I encountered an issue: I am unable to control the number of ellipses. I would like to have 100 ellipses with one specific aspect ratio and 100 ellipses with another specific aspect ratio, without them intersecting. Is there any way to achieve this?

---

<div class="post-metadata">

**Author:** ![laurent\_delrieu](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/laurent_delrieu/32/601605_2.png) [@laurent\_delrieu](https://discourse.mcneel.com/u/laurent_delrieu)\
**Post date:** [May 18, 2024, 9:49pm UTC](https://discourse.mcneel.com/t/closed-curves-packing/182242/4 "2024-05-18T21:49:17Z")

</div>

Hello  
this is not possible with my tool but as my tool outputs more ellipses you could suppress some of them.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/d/c/3dc976bc403763f164823ba35e381f2e53460fa6.jpeg)  
[MODIFIE.gh](https://discourse.mcneel.com/uploads/short-url/g6I3ijFL86imkWA3S9SSDjOGhfo.gh) (14.9 KB)

---

<div class="post-metadata">

**Author:** ![Mr.Ralf](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mr.ralf/32/723813_2.png) [@Mr.Ralf](https://discourse.mcneel.com/u/Mr.Ralf)\
**Post date:** [May 18, 2024, 10:39pm UTC](https://discourse.mcneel.com/t/closed-curves-packing/182242/5 "2024-05-18T22:39:42Z")

</div>

Dear @laurent_delrieu  
you really helped me here, thank you so much
