Y otra vez me arranco despacito, al sentir que nada necesito (Locura transitoria, Extremoduro)
One of my favorite sites in the Internet is algorithmic botany . It’s always a source of inspiration for me. I recently discovered there the space colonization algorithm, concretely in this paper. Originally, the algorithm was developed to simulate leaf venation patterns as well as the branching structure of trees and it works by simulating the competition for space between growing veins (or branches). Given a initial set of attractor points (3.000 points in my case), and a initial node (also a point located randomly inside the picture) the algorithm performs the next steps iteratively:
- measure distances between attractors and nodes
- assign the closest node to each attractor
- keep just those pairs (node, attractor) which distance is between a minimum and maximum
- normalize and obtain the unit average vectors for each node
- create a new set of nodes using previous vectors and a predefined longitude
Once again, I used this image of Boris Karloff as Frankenstein’s monster to experiment with the algorithm. I have to say that I coded my own version of the algorithm which maybe is not the canonical one inspired by the previous paper as well as by this tutorial by the coding challenge. This is the resulting drawing using my preferred parametrization. As you will see in the code, I overimpose several layers of colonizations. I love the resulting images:
Play with the parameters to create your own images. If you improve my code, do not hesitate to do a pull request in Github if you want.