
If you’ve stuck with the examples this far, this one should prove pretty easy. I am showing it here for a bit more practice with vectors and data structuring, but this will serve as a base for a recursive pattern script in the next series of examples. Try and create your own script using only the text provided, but you can cheat and look at the final script overview image if you get stuck.
Step One – Setup a base grid of points using either the center points derived from a Square Grid using the Area component or a custom Grid created from two number Series as explained in Example 1.3. Setup a starting vector and define a rotation for the vectors at each point. The logic is similar, but executed in a slightly different way than the starting vector as explained in Step 1 of Example 6.3.
Step Two – Now you want to rotate your initial vectors based on the results of a Random Number Generator (RNG). I could just random rotate all the vectors at once by flattening the initial grid of points, but for this example I wanted to control the “noise” or degree of random rotation for the rows and columns independently. To do this, I defined two variables which I called “Row Distortion” and “Column Distortion.”
We will do the “row” distortion first. A value of “20” for row distortion means then, that the first range of rotations, based on rows, can have a rotation between -20° and 20° after I Construct a Domain using my parameter and its Negative as inputs. This goes into the Random components R input, along with the number of rows for the N input, and any number for the random seed or S input.
Since I didn’t flatten my data structure, after the first set of random rotations, each item in every row will have the same rotation. To rotate the vectors, use the Rotate Vector component with the output of the RNG fed into the Rotate Vector component’s angle, making sure this is set to degrees.
Step Three – Now I want to do the same thing for the columns. All I have to do is use the Flip Matrix component to change the way the points are arranged in the data structure, and then do another series of random rotations using a second RNG set up exactly as before, but with a different seed.
Step Four – The last thing to do is to draw a line using the Line SDL component. The Start will be the grid points, the Direction will be the rotated vectors, and the Length will be just a variable based on the sliders.
Below are some images of variations based on this script.

And finally, the completed grasshopper script is shown below for reference.

