# What is the key component for getting gradient circles effects

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.

Hi @cmrhm,

Is this what you are looking for?

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.

1 Like

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.

1 Like

Thanks! This is so nice.

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

1 Like

HI, P1r4t3b0y:

which component control the middle no circle part?

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

This is controlled by this portion:

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.

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.

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 (19.7 KB)

I got what you are saying for this part.

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!

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.

1 Like

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?

You could use Kangaroo

Here a way

Another way of doing

4 Likes

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

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

I donâ€™t understand what you mean.

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.

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

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?