I’ve recently gotten into creative programming. After doing a part time job as a full stack web developer, I wanted to try something creative.

I have been working on a personal project, a chaos game fractal generator library. My interest in generative art, artistic fractals has sparked as I see random fractals being generated with ease.

The library can generate the famous Sierpinski triangle.

This project uses Python, Numpy and Matplotlib. Python was too slow for this project. Generating millions of points and rendering them with Matplotlib takes few minutes.

Creative Programming

Effective (in terms of speed and ease of structuring) creative programming can be accomplished with the a Java library called Processing.

I have started using p5.js, a Javascript alternative to Processing. I wanted to make interactive art accessible.

(I’m aiming to code in a functional style. I’ve looked into libraries such as Rambda. Rambda seems pretty promising.)

Creative Process

I’ll introduce some processes which can create artistic pieces. (Besides from wellknown fractals like the Mandelbrot set and the Sierpinski triangle.)

Tesselation

Tesselation is tiling of a plane using one or more geometric shapes (Wikipedia). Tesselation can be seen in tiles.

One thing I like about tesselation is that you can tessellate arbitrary fractals. The tiling below is a tesselation of a fractal, Koch snowflake.

Koch tessellation

Though maybe not exactly tesselation, M. C. Escher’s Metamorphosis pieces are my favorite of his art. (I saw his actual pieces in an exhibition in Tokyo and was surprised by the size of the piece. It spans horizontally.)

M. C. Escher had in mind the mathematical concept of tesselation when he created the pieces.

Escher Metamorphosis

By Official M.C. Escher website, Fair use, Link

Escher Metamorphosis

By Official M.C. Escher website, Fair use, Link

These pieces flattens an image into a tessellated pattern. This is my favorite example of tesselation being integrated into art I know of.

Chaos game

Chaos game is a method of creating fractals.

The fractal is created by iteratively creating a sequence of points, starting with the initial random point, in which each point in the sequence is a given fraction of the distance between the previous point and one of the vertices of the polygon; the vertex is chosen at random in each iteration. Repeating this iterative process a large number of times, selecting the vertex at random on each iteration, and throwing out the first few points in the sequence, will often (but not always) produce a fractal shape. (Wikipedia)

Fractals like the Sierpinski triangle can be generated by setting the before mentioned fraction to \(\frac{1}{2}\). However, by applying restrictions to the above method, we can create many variations of fractals. For instance:

A point inside a square repeatedly jumps half of the distance towards a randomly chosen vertex, but the currently chosen vertex cannot be 2 places away from the previously chosen vertex. (Wikipedia)

I have implemented custom restrictions in my generation library. https://github.com/RW21/chaosgame

The result is this.

cg = ChaosGameRegularPolygon(4)
cg.chaos_game_restricted(1000000, 0.5, 2)
cg.generate_heatmap(save='sample.png')

Fractals appearing from apparent randomness was what caught my interest. I have listed more examples on the readme page of the repository.

Resources

A list of useful resources for learning Processing. WIP

  • 数学から創るジェネラティブアート
    • Japanese. Implements design with Processing from mathematical principles.
  • The Nature of Code
    • A free PDF is available online.