## Single Point Attractor – Example 2.1

A common method for form management in parametric modeling systems and contemporary design is to use a concept known as an attractor. This example of a single point attractor has very limited practical use, but the concept can be adapted to more complex situations with multiple point attractors and curve attractors, which I’ll show in the next exercises. The general concept, however, is that a process or form is scaled incrementally based on its proximity to another object. In this example, circles are scaled down based on their proximity to a point; the closer a circle is to the point, the smaller they get. If the point is moved to a new location, the circles impacted change. It also includes a gradient tool to color circles based on their distance. Variables that can be changed are maximum circle size and the range of the scaling affect.

**Step One – Basic Setup **

Setup a hexagonal grid and flatten the points. Draw a circle at each one of these points. The radius can be left blank for now.

**Step Two – Measure distances between each circle and an attractor point**

A point (drawn in Rhino, not grasshopper) is linked into the script using a Point Parameter container. The distance function then measures the distance from each point in the hexagonal grid and this input point. You will not see any output from the distance function on the screen, but you can add a panel after the distance to see the values.

**Step Three – Use distances for radii**

This involves a bit of math. The distance is divided by a factor, which will affect the rate of scaling as you move away from the point. These results are input into the circle’s radius. In the example above, the distance scaling factor is “8”. So if a circle’s center point is 1 unit away from the attractor point, this divided by 8 is .125, which will be that circle’s radius. If the center point is 10 units away, the radius would be 1.25 and so on.

**Step Fo****ur – Setup a maximum radius size**

At some point, you will probably want the scaling to stop, otherwise the circles will get too big and create a messy design. So before being input into the circle radius, one other component, the “Minimum” component is used. This compares two values and uses the lesser of the two. If the maximum circle size is set at 1.7, as in the example above, but the result of the ( Distance / Factor) is 8.5, for example, the lesser of the two values is 1.7 and this will be used for the circle’s radius instead of 8.5. Its a bit counterintuitive at times, using a Minimum component to set a Maximum, but when you think about the math it makes sense.

**Step Five – (Optional) Add a Color Gradient**

To demonstrate the gradient tool, I added one step at the end to color the circles. The gradient tool takes a bit of practice to get used to, but can come in useful in many situations. A gradient tool needs three inputs. A value to start the gradient (L0) a value at the end of the gradient (L1) and a value (t) which is the value of the object which the gradient will be applied to. In this example, I find out the minimum and maximum distance of the circles away from the attractor point by using a “Bounds” component, which shows the Domain (or the range) of circle sizes. In the example above, the closest circle has a center point at a distance of ~1.6 from the attractor and the farthest center point has a distance of ~27. Once you have the “Bounds” you can use a “Deconstruct Domain” component to separate these numbers into an “S” and a “E” (Start and End). These values are input into L0 and L1 respectively on the gradient.

Now the computer measures each circle’s distance and inputs that in for t. A circle that is close to the attractor (say 2 units) would get a color towards the left of the gradient, a circle that is far from the attractor (say 25 units) would get a color towards the right, and a circle 13 units away from the attractor would then receive a color somewhere close to the middle of the gradient. This color is applied through the Custom Preview component to surfaces generated from the circles.

**Variations**

Below are variations where the point in rhino moves, where maximum circle size is changed, and where the distance factor is changed to affect the rate of scaling. In these examples, I increased the size of my starting grid to create more circles. Below each image is a short clarification of the parameters changed or used.

And finally, a screenshot of the grasshopper script with a few explanations of what is going on…

**Click Here to Download GH File**

Great example. Very clear and organize. Thank you!

LikeLiked by 1 person

can this definition be applied to forms other than circles? what about 4 sided polygons such as a grid of rhombuses?

LikeLike

Yes, it should be applicable to Most forms. You just need to find the centerpoint of the form, the distance from that centerpoint to the attractor point, and then be sure to scale each form around its own centerpoint.

LikeLike