A couple of weeks ago, I saw that some developers forked the project on GitHub. It made me feel slightly guilty that I left the code so buggy, so I started working on that again. The latest code has big improvements over the version from two years ago. The underlying algorithm is the same, but that's about it. The most important changes are the following:
- The image generation and display now happen at the same time thanks to SDL.
- For compatibility with SDL, the code is now in C++. Although to be honest, it's mostly still C with the C++ features that I needed.
- Generating images of aspect ratio ≠ 1 is now supported.
- More colormaps are available (not only monochrome).
- The image generation itself is better encapsulated in order to make it independent from the display.
- Some image generation steps are combined together instead of spread out over several functions. This probably makes the algorithm a bit more difficult to follow but removes the need for intermediate arrays, which reduces the memory usage and increases the generation speed.
- The image width, height and colormap can be set by command line arguments.
- When running, preset patterns can be added or removed with the +/- keys on the keypad, and the image can be reset by clicking in the window.
- Symmetry functions are simpler, although for the moment only symmetry orders 2 and 4 are implemented.
Here's a 640x480 image with 5 patterns and the "dawn" colormap. Sweet!
The improvements that I'm most interested in are the following:
- Make a GUI to be able to change the pattern parameters and the colors during generation. That would be süper cool.
- Depending on how the live-controlled generation goes, it would probably be useful to accelerate the code. Most of the time is spent at the lowest level of the algorithm, i.e. the blurring functions. If there's any time to win, it's there. I'm also thinking about multithreading. The activator/inhibitor array generation for the different patterns are independent, it's only when computing the variation array that they all have to be ready. So they may be parallelized.
- Implement better symmetry. A clean rotational symmetry algorithm for symmetry orders different than 2 or 4 is still something I haven't been able to develop.