# What is the key component for getting gradient circles effects

**URL:** <https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406>\
**Category:** Grasshopper\
**Created:** [April 26, 2019, 6:07am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406 "2019-04-26T06:07:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 6:07am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/1 "2019-04-26T06:07:25Z")

</div>

![gradientCircles](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/1/0/10fe6598257527fb1fe07e1b19feed610bec8ae2.jpeg)

Hello,I want to achieve the gradient circles to be mapped into a rectangular, middle of the rec has no circles. See the attached. Any ideas of what I should do? If there is a sample definition, that would be great.

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 7:16am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/2 "2019-04-26T07:16:34Z")

</div>

Hi @cmrhm,

Is this what you are looking for?

 ![gradient_circles](https://global.discourse-cdn.com/mcneel/original/3X/9/2/9263549860f1e3e30aab86975c2a5ccd22f5bcc9.gif)

You can change the size of the rectangular boundary, the initial circle center point density inside the boundary, the position of the center line, the maximum allowed distance of the circle centers to the center line, as well as the minimum and maximum circle radii.

If by any chance, you don’t want variable circle radii, you can simply, delete the following components (red), connect the culled circles as shown in the screenshot and define a constant radius for all the circles at the `Circle component`.

 ![22](https://global.discourse-cdn.com/mcneel/original/3X/4/0/40d4c7608ae39315364ee760783a8c76235e1b4d.png)

[gradient\_circles\_01.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/8/5/85fb81e5dd5601d6257d6ebb648d4ffd577f710c.gh) (20.6 KB)

---

<div class="post-metadata">

**Author:** ![parametriccuriosity](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/parametriccuriosity/32/653813_2.png) [@parametriccuriosity](https://discourse.mcneel.com/u/parametriccuriosity)\
**Post date:** [April 26, 2019, 7:34am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/3 "2019-04-26T07:34:13Z")

</div>

That was nice script but an other strategy to find that middle line can be to start with a surface and divide its v domain into 2 parts and extract middle line from there. But very nice logic for the script. Thank you for sharing it.

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 8:16am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/4 "2019-04-26T08:16:24Z")

</div>

Thanks! This is so nice.

I will take time to study it and ask you several questions.

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 8:54am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/5 "2019-04-26T08:54:43Z")

</div>

HI, P1r4t3b0y:

which component control the middle no circle part?

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 9:15am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/6 "2019-04-26T09:15:15Z")

</div>

the definition looks a bit too complicated for me to understand. Is there any quicker and easier way to do this?

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 9:41am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/7 "2019-04-26T09:41:23Z")

</div>

> [@cmrhm](#):
>
> which component control the middle no circle part?

This is controlled by this portion:  
 ![56](https://global.discourse-cdn.com/mcneel/original/3X/2/c/2c5af9ee5fce7af9136185cc6c88b909f5aff20c.png)

The initial random points are pulled to the middle line, since we need the distance of each point to this line. These distances can then be compared to your desired maximum distance (slider) to the center line. If the point is too close to the center line, it gets culled, “deleted” from our point list. We do the same for the distances, since we only need the distances of the remaining points for the next step, which is the evaluation of the different circle radii.

> [@cmrhm](#):
>
> the definition looks a bit too complicated for me to understand. Is there any quicker and easier way to do this?

The definition is really is not that complex or long. I don’t really know, if there is a quicker or easier way. There might be, but this works! 🙂

What apart from the above mentioned portion, do you have problems understanding? Are you new to Grasshopper?

I invite you to turn the visibility of components on and off to be able to see what they intermittently do. You can also hook up panels to component outputs to see what one component passes to the next.

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 9:53am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/8 "2019-04-26T09:53:30Z")

</div>

Thanks for your reply. My ultimate goal is map these circles into a curve. Anyway to revise your definition to make this happen?[gradient\_circles\_01- LX.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/2/2/225bc5341d70f2f607ffa3bac358938bf85953ab.gh) (19.7 KB)  
[test-gradientCircles-LX.3dm](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/f/a/fa2bda2eedf7b2d81f22d16fb4b3c502e6250100.3dm) (38.9 KB)

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 9:57am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/9 "2019-04-26T09:57:18Z")

</div>

> [@diff-arch](#):
>
> The initial random points are pulled to the middle line, since we need the distance of each point to this line. These distances can then be compared to your desired maximum distance (slider) to the center line. If the point is too close to the center line, it gets culled, “deleted” from our point list. We do the same for the distances, since we only need the distances of the remaining points for the next step, which is the evaluation of the different circle radii.

I got what you are saying for this part.

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 11:17am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/10 "2019-04-26T11:17:08Z")

</div>

> [@cmrhm](#):
>
> Thanks for your reply. My ultimate goal is map these circles into a curve. Anyway to revise your definition to make this happen?[gradient\_circles\_01- LX.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/2/2/225bc5341d70f2f607ffa3bac358938bf85953ab.gh) (19.7 KB)  
> [test-gradientCircles-LX.3dm](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/f/a/fa2bda2eedf7b2d81f22d16fb4b3c502e6250100.3dm) (38.9 KB)

You’re welcome! In fact, not much has to change, to make it work with a custom boundary and curve.  
Instead of looking for the center line first, you can now simply input your hand-drawn curve into the `Pull (Pull Point)` component. You can even go crazier with your curve! 😉

 ![47](https://global.discourse-cdn.com/mcneel/original/3X/5/e/5ee7f95a600c90f7ddf8eec95d845c3bcc90c49c.png)

Since, `Pop2D (Populate 2D)` only works with rectangular boundaries, you can simply use it with the bounding rectangle of your custom, closed boundary curve, and cull the points that lie outside.

The rest works exactly the same! No worries here.

[gradient\_circles\_02.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/b/b/bb52cf059e007eb7265a2a9dbe626e6f0b1a8e86.gh) (15.0 KB)

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 11:36am UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/11 "2019-04-26T11:36:32Z")

</div>

![57](https://global.discourse-cdn.com/mcneel/original/3X/b/a/ba10326657b4ba0f4f1bddd292c268e3df1f78b3.png)

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 12:17pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/12 "2019-04-26T12:17:35Z")

</div>

thanks, is there anyway to add one definition - let these circles don’t touch each other?

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 12:26pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/13 "2019-04-26T12:26:51Z")

</div>

> [@cmrhm](#):
>
> thanks, is there anyway to add one definition - let these circles don’t touch each other?

Hm, I guess that would be a more involved topic. You could look into **circle relaxation** or **circle packing**! Are you familiar with coding (C#, Python, etc.) or Kangaroo?

---

<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:** [April 26, 2019, 12:36pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/14 "2019-04-26T12:36:03Z")

</div>

You could use Kangaroo

 ![image](https://global.discourse-cdn.com/mcneel/original/3X/7/e/7e9d6e0e6a3e358eb8523475f4593c4a11e0f8ad.jpeg)  
Here a way  
[gradient\_circles\_02\_LD.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/a/4ae8330b65f74bf94503888b13b5ce7e5d141798.gh) (17.1 KB)

Another way of doing

 ![image](https://global.discourse-cdn.com/mcneel/original/3X/4/f/4f6846a597f1f33cfdc95364815c78cec66afded.png)  
 ![image](https://global.discourse-cdn.com/mcneel/original/3X/1/2/126fd0fad95f73cec15902ae489f2e8fb4bf9eb4.jpeg)

[gradient\_circles\_03\_LD.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/2/5/25f2ec4e9376a8aabc26d8c9817522041cfdb771.gh) (12.9 KB)

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 1:39pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/15 "2019-04-26T13:39:47Z")

</div>

Here’s another solution without Kangaroo or scripting. The trade-off is that you can’t define the maximum radius yourself.

[gradient\_circles\_03.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/9/7/9788c79f3e1519d63db6883de1053f36c025e845.gh) (20.7 KB)

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 1:49pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/16 "2019-04-26T13:49:41Z")

</div>

Thanks.  
What about using intersection related component with toggle to get seperated circles?

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [April 26, 2019, 1:55pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/17 "2019-04-26T13:55:47Z")

</div>

> [@cmrhm](#):
>
> What about using intersection related component with toggle to get seperated circles?

I don’t understand what you mean.

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 2:06pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/18 "2019-04-26T14:06:46Z")

</div>

My idea is to check if each circle intersect with each other first, if it is, remove one circle.

Now all the left circles should be separated.

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 26, 2019, 2:12pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/19 "2019-04-26T14:12:09Z")

</div>

Thank you. I noticed your definition is using more restricted placed circle instead of random located circle, is this the way doing in Kangaroo?

---

<div class="post-metadata">

**Author:** ![cmrhm](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cmrhm/32/149172_2.png) [@cmrhm](https://discourse.mcneel.com/u/cmrhm)\
**Post date:** [April 27, 2019, 3:23pm UTC](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406/20 "2019-04-27T15:23:22Z")

</div>

Hi,

I am testing your definition with realistic object, a facade panel for a stair, and I can’t make it work. Is this something related to the circle size or similar setting up?

I can’t figure out yet, please help if you have time. Many thanks! [SStair-parametric1.3dm](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/e/c/ec187421f5112dce078b63242ac331346173093e.3dm) (41.7 KB)

[Next page](https://discourse.mcneel.com/t/what-is-the-key-component-for-getting-gradient-circles-effects/82406.md?page=2)
