A Generative Bisection

David Somers bio photo By David Somers Comment

The bisection of the pictorial space. I have explored and doodled this theme in various media: pencil, fiber, raffia. Today, time to get into the digital and make some generative art.

one

images/mava/dso-113137-e7818abf28c83b38e7ef56d7cdbecddd486d4b3e5b7e7cda922348e1e97475ba.jpg

A simple division. The line starts at the exact bottom middle and progress upwards. As it does so it randomly moves to the left or to the right.

two

images/mava/dso-113138-e7818abf28c83b38e7ef56d7cdbecddd486d4b3e5b7e7cda922348e1e97475ba.jpg

The line is only drawn when the end point is also at the exact middle of the canvas. A brute force approach is taken, repeatedly generating lines until the required end condition is met.

a ‘more efficient’ two

images/mava/dso-113139-e7818abf28c83b38e7ef56d7cdbecddd486d4b3e5b7e7cda922348e1e97475ba.jpg

No aesthetics are changed, but the code is modified so the line is drawn only when necessary (which makes it a bit faster). In the previous one, with each iteration the line was created, but not drawn, until the conditions were met. That was ugly, slow, and resource hungry. Now fixed.

three

images/mava/dso-113140-e7818abf28c83b38e7ef56d7cdbecddd486d4b3e5b7e7cda922348e1e97475ba.jpg

To ensure ‘balance’, the line is now only drawn when, in addition to ending in the middle of the canvas, the pictorial space is exactly bisected. Again, a brute force approach is taken, repeatedly generating parameters for the line until the required conditions are met. This hit-or-miss approach has lines being drawn after as few as 2,000 iterations have been tried, to as much as 33,000 iterations. The iteration time can be reduced by allowing a small deviation (such as ±0.02% instead of 0.0%), and the result is almost exactly correct (or at rather it is imperceptible to the eye).

Thoughts

The development of the code was done in an iterative manner. Each was a small step, an incremental improvement, and also a learning experience. The algorithms I made are fairly simple, but they work, and achieve what I wanted. The random movement of the line was produced by a pseudo-random number generator, but it would be an interesting exercise to see how this movement could be achieved with Perlin noise (Pearson, 2011, pp. 57-59) and whether the aesthetic would be different.

The core code that I wrote was comparatively small: about 30 SLOC. There is a beauty in this. The ability to write something minimal and efficient, but which explores a complex concept and produces a nuanced output.

Bibliography

  1. Pearson, M. (2011) Generative art: A practical guide using processing. New York: Manning.
comments powered by Disqus