inconvergent

On Generative Algorithms

Differential Line Github

Differential is an algorithm that I had been wanting to make for a long time. Eventually the solution just came to me, and I managed to get it working. What I wanted to do was create a system that behaved similarly to surfaces in nature that fold in on themselves. For instance the way walnuts do, as well as the layers of cabbage, (I won't go into how much time I've spent googling images of red cabbages split in half), our intestines and several leaves and flower petals. And probably several other things.

Before I started thinking about this I had only seen Floraform by Nervous System, but you should check out Cellular Forms by Andy Lomas as well. Another relvant paper, which I discovered much later, is here. I have also written an animated introduction to this.

First I tried using a method that was based on the Koch Snowflake fractal. But with randomized growth instead of symmetric and regular as in the fractal. I never got this working, and I quickly gave up. Some time later (six months give or take), however, I realized that I could introduce new nodes, as when the Koch Snowflake "grows", but I had to have the nodes move relative to each other as well. That way they could adjust their positions dynamically. Somewhat like pearls on a string. That way they can keep a comfortable distance to other nodes (pearls).

The algorithm goes like this: First we start with a set of connected nodes in some shape (circles or lines are good). Then we randomly introduce new nodes between pairs of existing nodes. In every iteration the nodes will try to optimize their positions. They want to be close, but not too close, to their two neighbors. At the same time they want to be as far away as possible from all other nodes within a certain distance. Note that there is no actual collision detection involved here.

differential line ani

There are a number of factors that will affect the behaviour of this system. One is how frequently we introduce new nodes. Another is the maximum distance within which nodes will avoid each other. And the most interesting one (in my opinion) is how we choose where to insert new nodes. We can do it uniformly, as in the animation above, or we can prioritize places where the curve bends more sharply, as below.

differential line curvature configuration

The difference is not entirely easy to pinpoint in these animations, but it gets very noticeable on large simulations. The image below uses the curvature based insertion method and took about 40 hours to complete.

differential line

Another way of getting interesting results from this system is by painting the position of the curve for each step in time. The visual and textural results are dramatically different, but it is easy to recognize the same characteristics.

differential line ani
differential
  line ani