[Demo]A simple mandelbrot calculator



it is time to also share some code :blush:.
Sources are here: https://os.mbed.com/users/ensonic/code/Mandelbrot/
For those who have no idea what I am talking about:

There are a few keys you can press (once the image has been calculated):

  • color cycle: left, right
  • zoom-in/out: up, down
  • move center: A + up/down/left/right

And here is how it looks:

Mandel.bin (30.4 KB)


A few things I stumbled upon while trying other screen modes:

Looks like:

has some copy’n’paste duplicated code.

When I try this in my settings:


and then use LCDWIDTH / LCDHEIGHT it will only cover 1/4 of the screen. With POK_LCD_W/H it works. Allthough when looking at https://github.com/pokitto/PokittoLib/blob/master/Pokitto/Pokitto_settings.h#L328 it looks that this should not matter (despite that the header should also use POK_LCD_W/H there instead of repeating the 220/176 there :))


Here is a high-res version (yes of course 4 times slower :/). It now handles keys once per line, so you don’t have to wait for the whole screen to render.

MandelHi.bin (29.7 KB)


Square-cube law.
Double both axes and you get 4 times the screen space.

On the bright side if it really is 4 times slower, that means your algorithm is probably O(n) so it scales relatively well.

The headers have a lot of redundancies and inconsistencies.
Not to mention a scary amount of build warnings.
Hopefully it’ll get cleaned up or replaced eventually.


@ensonic This also added to newest gamedisk, thanks !