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.



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.



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


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.



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).


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.


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