Intro to Attractors
Attractors are basically data that is used as a way to control other parts of our Algorithm. In this case, our Attractor will be the Point in the middle. We will be using distance as the driving force of our Algorithm.
Looking into our data
All those output slots we are connecting are holding on to data. To continue to understand Algorithms we need to know how Grasshopper handles data. I will keep it very simple but if you are confused don't be disheartened. It took me countless hours to wrap my head around this single aspect of Grasshopper. Their is much more in depth books and pdfs that can help you understand. Be warned though, this is barely scratching the surface. It gets much, much more complex. That is for another day though. I will try to keep it as simple as possible
Panels and Param Viewer
- Param tab> input> add a Panel
- Param tab> utility> add the Param Viewer Component
- Connect the Output slot of our Distance tool into each of these components.
- Duplicate the Param Viewer and double click on the center to view the tree.
What we are seeing in the panel is a list of all the measurements between that one point and all the grid we created. In the Param Viewer we are seeing a single branch. Since we flattened our Points in the previous steps it keeps everything very simple. We just have a giant list of these measurements. I will be placing panels in my screenshots just for the sake of education. So if you see one placed, it will usually be to help explain the process.
Using and Remapping that data
Now that we have this data we need to remap it into other aspects of our design. We will start by placing circles on our grid points and using the raw distances data as the radius. Then we will manipulate the data finding the bounds of the distances, and remapping that to a domain that is more suitable for our scaling exercise. I know this might sound complex if you have never used these terms before. In layman terms, we will find the closest distance and farthest distance, and scale those numbers closer to what we need.
- Curve Tab > Primitive > add the Circle Component
- Connect our grid points output slot into the Circle Input P slot
- Connect the Distance output slot into the circle Radius input slot
- Hide the other components by selecting them>Spacebar >Disable Preview
Just adding this already gives us a very cool pattern by surprise. This is another thing I love about Grasshopper. Sometimes accidents can become beautiful patterns that you would've never thought of.
Remapping the Number
- Math Tab > Domain > add a Bounds components
- Math Tab > Domain > add Remap Numbers components
- Math Tab > Domain > add Construct Domain components
- Add two Number sliders
- Connect the Distance output into the Bound components
- Connect the Number sliders into the Construct Domain components
- Connect the Distance output to the Value input in the Remapping component
- Connect the bounds output into the S input in the Remapping component
- Connect the Construct Domain output into the T Input in the Remapping component
- Move the Number sliders around
Adding a Distance Threshold
Their will be times where you don't want the whole grid. For this we will use our friend math. This is the first time you will be introduced to Culling. Culling just means removing the data from our algorithms. In layman's terms, I am just telling grasshopper I only want the closest 25 percent..
Culling the points
- Make the Domain sliders into 0 and 1
- Math Tab > Operators > add a Smaller Than component
- Add a Number slider and place it at .25
- Set > Sequences > add two Cull Pattern component
- Connect the Remapping output R into Smaller Than A input
- Connect the .25 Number Slider into Smaller Than B input
- Connect the grid Points into one of the Cull Pattern L input
- Connect the Smaller Than ">" output slot into Cull Pattern P input
- Connect the Remapping output R into the other Cull Pattern L
- Connect the culled points into Circle P input
- Connect the culled Remapped numbers into Circle R input
Remapping our new Point
As you can see we are using the same remapping for distance threshold and scaling. What we need to do is use remapping twice. Once to eliminate the points we want, then again to remap the new points into a scale we want. We have already gone over these concepts so I want you to try it on your own. Remember you have a new set of closer numbers, we need to remap those and apply them to our scale. If you get lost just deconstruct the Algorithm by looking at my image,
Culling is just removing data you don't want. If we go back to our simple Dice example, we can simplify the concept. I am using a Larger Than component to figure out which numbers are great than 5. This give me a culling pattern I can use to separate the data. I can use the Cull Pattern component to remove all the unwanted numbers. In this case only 5 didn't meet the condition. So once I run it though the Cull Pattern component, my 5 is removed. I can also use a components called Dispatch to separate the list into those who passed and didn't.
Putting what we learned to work
Even though our example is quite simple. If you understand these concepts you actually have giving yourself an incredible new tool for your design process.