Diffuse Limited Aggregation Structure – Example 10.2

G1_01 A fairly useful and simple fractal growth process that can be used for modeling natural structures is known as the Diffuse Limited Aggregation algorithm. Many growing structures in nature follow this logic, from colonies of bacteria to cities! A fairly good description of this process can be found here, where the particles undergo what is called “Brownian Motion” (a random walk) before they aggregate to the structure, but for now I am going to simplify it even more, and the results will still be pretty close to what we want.

Basic Process G1_S01 1. The two inputs from Rhino are a boundary curve (in this case a rectangle) and a point. A short line is drawn at the point and this is placed into a loop.

2. A random point is generated within the boundary curve. From this random point, the closest point on the aggregation structure is found. On the first round this is a point on the initial line. Later the closest point could be on this original line or on a line from previous rounds. The vector between the new random point and the closest point is identified, and then a new segment is draw from the random point in the direction of the vector.

3. The new segment is moved along the vector until it “attaches” to the existing line. The movement is simply the value of the vector minus the length of the segment.

Further Recursions G1_S04 As opposed to fractal processes that multiply geometry, this creates only one new set of geometry per round, so it will continue to run very fast. I ran this process over 10,000 times and it still worked. But the basic process remains the same. After a few rounds, the structure will start branching, like tree roots or a river system. Now I want to mention something I alluded to in Example 10.1, which is how the random values are generated. This is incredibly nerdy and wonky, so you can safely disregard it if you want, in which case you can pick either of the two variations below to test out. For those interested, I will show two variations of the script, one where the values are generated “inside” the loop” and one where they are generated “outside.” The results will be slightly different in both cases.


Script Variation 1 – Random population happens “inside” the loop

So in this variation, you can see that the counter is used to “reset” the seed after every round. The round is multiplied by a slider (so you can still change the seed), but also notice I added a random number (1.3) to the round just so I wouldn’t have the case where the random seed is stuck at zero. (0 times anything is still 0).  What this does, though, is it populates only 1 point every round, which is used in the process. The thing with this approach is that certain structures will start to appear in your results (which you may or may not want) since the way the computer generates random seed sets is not entirely random. (hope that makes sense!) I will show an example soon.


Script Variation 2 – Random population happens “outside” the loop

In this second variation, the random values were generated before the looping started by populating the area with random points equal to the number of anticipated rounds. Values are then called for one at a time based on the counter, in exactly the same way we called values in Example 10.1. So this will generated more “random” results, with the caveat that there is never a possibility of a random point being generated twice in the same location, which could be a possibility in variation 1. G02_ScriptB_results In the first two examples above, I used Script Variation 1 to generate the results. Notice that certain “structures” start to form in both cases. The structures will be different depending on the seed you choose, but in many cases will be there, although some seeds seem to show less organization that others. In the third image, done with Variation 2, the structures will not appear and all seeds will generate “similar” results. You can decide which you prefer, but it could also depend on your application.

Variations G1_options Above you will see some possible outputs, all generated with “Script Variation 1” In the first 3 images, I changed the random seed. You’ll notice in variation 2, especially, the “structure” comes out pretty strongly, but variation 3 has very little structure and approaches the randomness of “Script Variation 2”. In the second three output images, I changed the length of the segments, which in effect makes either a compressed simulation or an “open” simulation. In the last three tests, I started with more initial points. Notice the growing structures compete amongst themselves, like plants in a forest, tree roots, or river basins. The growing structures that get off to the best start will suck more and more of the newly populated points to themselves while the structures that start out slow will always languish.G1_11 This last image was a fun test. i wanted to hypothesize what Europe’s river network would look like if the continent had no mountain ranges. The initial points are 300 evenly spaced river mouths on the coastline. The new random points are generated randomly anywhere on the continent (using Script Variation 2) and they find their way to the closest river mouth or river network. The biggest loser here is the Danube, since the Alps and the Balkans are not blocking the rivers coming from the Adriatic sea, but some of the river networks, especially in the flat parts of the continent, come pretty close to approximating the real thing!