Multiple Point Attractor with Random Point Cloud – Example 2.2
A multi-point attractor follows a similar logic as the single point attractor, although distance is measured in a slightly different way. In principle, however, a multi-point attractor is much more useful than a single point one, and this script can for all intents and purposes replace a single point attractor script, if only one point is fed into the script. Just to change it a bit, for this example, instead of manually inputing points, I am introducing the random population component. Keep in mind you could also manually input the points by drawing them in Rhino and importing them through a point container.
Step One – Setup Grid by Using Divide Surface
Yet another way to set up a starting grid. If you expand a grid by adding columns or rows, it will get bigger spatially, so then you need to go back and reduce the cell size to keep it roughly the same size. However, If you have a fixed surface, (or project site) but want to test out the range of divisions of that surface, this is a good way. Here I have a boundary rectangle I drew in Rhino, which I input into Grasshopper. I then converted it to a Surface using “Boundary Surface” and divided this surface into “tiles”. This was done using the “Isotrim” component with a domain obtained from using the “Divide Domain2” component in conjunction with the Boundary Surface. “Divide Domain2” has sliders for U and V values, which are sort of equivalent to X and Y but not quite, since they are relative to the surface, not to the world X and Y. This creates the domain for the “Isotrim” component which is confusingly labeled SubSrf. From these subdivisions I will use the Area component to find the center of each cell, which in turn will be used to set my circle center points in the next steps.
Step Two – Populate Random
instead of drawing my points in Rhino, for this example I am going to populate my region with a random “cloud” of points. There are several tools to populate an area with random points. Populate 2D, Populate 3D, and Populate Geometry. “Populate 2D” has limited usefulness, and can only be used with flat, rectangular, areas. “Populate Geometry” will prove much more useful in future exercises, but for now I will use Pop2D. Like any random function, a seed value is attached.
Step Three – Measure Distances
Now I measure the distance similarly to the previous example 2.1, but I use the “Closest Point” component to do this instead of distance. “Closest Point” is a very useful component with many applications. The trick is to decide what goes into the “P” input and what goes into the “C” (cloud) input. This will take some getting used to, but if your results aren’t as expected, often you just need to reverse these. What “Closest Point” does is measure from each cell center point (P), the future center points of my circles, and it finds the closest point in my cloud of attractor points (C), and outputs the distance to this point through the “D” distance output, among other outputs. For now, though, the only output that interests us is this “D”.
Step Four – Draw circles and set radii
Step Five – (Optional) Cull Smallest Circles and Color Circles
An optional thing you may want to add with an attractor script is a “Cull Pattern” to get rid of circles that are too small. In this example, circles smaller than radius .11 are removed. I also gave the remaining circles a color using “Boundary Surface”, “Swatch”, and “Custom Preview”
Below are variations, using various random number seeds for the point cloud, a different number of random test points, as well as scaling the Range of Effect as in the previous example (2.1). If you change the grid size, you may need to adjust some of the factors, especially maximum circle size.
And here is a screenshot of the Grasshopper script…