More Genetic Algorithm Drawings

Some more sample results from a drawing app I am working on that uses a genetic algorithm to generate drawing (click for higher resolution):


Above: face 1, Below: face 2 (same source image as face 1)



Above: one generation of faces (same source as face 1 and 2)


Above: face 3 (different source image), Below: landscape.



Screen Shot 2016-08-27 at 1.59.43 PM

The effects of mutations in one generation of spirographs. Choosing only one graph to survive from the previous generation (not a natural thing to do) results in 36 offspring from the one graph. It is an good way to check the impacts of mutations in the genetic algorithm and has an interesting outcome. The parent graph is below.

Screen Shot 2016-08-27 at 2.05.02 PM



This Spirograph algorithm is not a strict interpretation of the physical Spirograph device but it generates some very similar and interesting results. The basic algorithm is to blend three circular equations together. Specifically, for values of i from 0 to 2 pi, an x and a y value are generated with :

x = r1 * cos(nr1 * i + o1) + r2 * cos(nr2 * i + o2) + r3 * cos(nr3 * i + o3);
y = r1 * sin(nr1 * i + o1) + r2 * sin(nr2 * i + o2) + r3 * sin(nr3 * i + o3);

In many ways, this is like having three lines of length (set as r1, r2, and r3) being placed end to end with each one rotated a given number of times (set as nr1, nr2, and nr3). Each of the rotations also can be offset (set by o1, o2, o3).

Two different graphs can be drawn in this way and each of those graphs can be duplicated by changing the number of iterations (o iterations would hide graph). Each iteration can be offset by an angle or have its radius scaled.


Screen Shot 2016-08-16 at 1.36.40 PM


Animated Waves

Building on the previous waves study, this sketch creates it’s own image from three dimensional Perlin noise. For each frame, an image is generated and variations in the brightness are used to vertically offset the horizontal lines, forming waves.

The running sketch (below) shows a frame of the noise and the waves below.

Screen Shot 2016-08-16 at 9.33.22 AM