Monday, June 13, 2011

Snowflakes: Creating a Netlogo Model for Emergent Properties in Aesthetics

 Original at http://beyondbitsandatomsblog.stanford.edu/spring2011/2011/04/28/netlogo-model-sam-and-rachel/


Video


WHAT IS IT?

This lets you generate regular geometric shapes. The inspiration is a snowflake, with the idea of a snowflake being generated regularly and recursively.

HOW IT WORKS

At each tick, all particles in the snowflake will create num-branches children around it. Each child is at a distance of branch-distance, which will get smaller with each tick. Each child is spaced regularly around its parent with a random number of degrees specified by the upper and lower bounds that the user chooses. It continues until max-order ticks have happened.

HOW TO USE IT

setup creates a particle in the center go runs everything max-order is the number of times children will spawn num-branches is the number of children that will spawn around each parent initial-branch-distance is the distance between the initial particle and its children.
lines? if true, will draw lines between children and their parents colors-change? if true, each child is darker than its parent. If order is high enough, the colors can wrap around to white again. if false, everything is white.
random-min-degrees, random-max-degrees: if both of these are 0, then children will be regularly spaced around the parent. When they are not 0, then they are used as a lower and upper bound on a random number of degrees added to the regular spacing for each child. When the lower bound is 0 and the upper bound is 360, the spacing will be completely random. branch-distance-drop-factor: if the initial branch distance is 100 and the drop factor is 2, then the initial particle and its children will will be 100 apart. The next generation will be 50 apart. The fourth generation will be 25 apart, etc.

Getting a Beautiful Snowflake

After setting up, the snowflake starts with one particle at the center:

The above setup doesn’t look too interesting because it’s a completely random snowflake:


However, with the variables at reasonable values, it begins to resemble a snowflake (or at least an interesting geometric shape):

One quick realization was that we were exponential. The number of particles in the last iteration of snowflake with order O and B branches was B^O. Thus, even when the variables were pretty small, the computation grew slow and the snowflake became solid ice. Order 4 could only really take 7 or 8 branches, and order 5 could only really take 3 branches before the shape seemed cluttered. Here is what we get with order 4 and 10 branches:



Here is one with more reasonable variables:


This one shows how cluttered it can get with high orders:


With order 4, everything looks too regular, so it gets pretty cheesy:



However, by changing the distance drop factor, we can make it spread out a little more, and it looks very nice:


Changing the initial distance doesn’t change the shape at all (since the shape is all regularly generated), but it makes everything more compact, so it’s harder to see the spaces in between the particles of ice, and it’s harder to appreciate the space as a whole.
If we make the image all white instead of having each successive generation be bluer, then the image also seems worse. Even though the earlier images practically seem all teal, the little spots of white really do matter. Having a monochromatic image makes it much harder to see the complexity within each generation:


Also, it appears as though much of the complexity comes with the regularity. Even 10 degrees of randomness at in each child can make the image as a whole seem very scattered:


30 degrees makes the snowflake devolve into a discordant vortex:


50 degrees makes it unclear even how many branches there are:


With a sufficiently small drop factor and a sufficiently large branch distance, it was possible to appreciate the maze-like repetitions within even high-order, high-branch combinations:


But again, it seems as though the snowflake-ness of a shape depends on the empty space:


There was also a big odd/even divide. With an odd number of branches, the images seemed less like snowflakes and more like circularish blobs:


However, lowering the drop-factor even more proved fruitful, even for an odd number of branches:


When the drop factor is eliminated, it looks even cooler: every child is as far from its parent, which means that the density of the snowflake decreases exponentially the farther it gets from the center, and because of a slight offset , there are a bunch of very fine and intricate lines:


Last, if we eliminate the lines connecting particles, the snowflake becomes different; neither better nor worse. It loses intricacies in some ways and gains them in others.


As may be evident by this point, the emergence that we were studying was the aesthetic value that came from the regular reproduction of similar agents. Most of the time we spent was trying to get pretty particles and make things that looked more like snowflakes. We made several changes to our model to help with this. For instance, we started with the distance between a parent and child particle set at a particular interval of the initial branch distance. That proved very ugly, so we changed it to a factor such that the distance would decay geometrically. This proved much nicer, especially with high orders. Another big change was to make it so that every child turned 45 degrees. This made it so that its children didn’t wind up on top of the link with its parent.
The best part was that, by programming a relatively simple model, most of the experimentation didn’t even have to do with the programming. We just needed to play around with the variables. Even though the variables might not have much of a correspondence to physical properties of snowflakes in the natural world, it still allowed an exploration of aesthetics and the discovery of the importance of variations, their regularity, variations of color, and variations of space.

No comments:

Post a Comment