Skip to content

chrisdenman/mandlegrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A React application for calculating familiar Mandlebrot sets images.

The following images were created using the tool:

B&W Mandlebrot Set Red Mandlebrot Set Odd Mandlebrot Set Random Mandlebrot Set Sophisticated Mandlebrot Set

Technical Details

The images are generated in two phases:

  1. Iteration data calculation - a pool of web workers (threads) is constructed. Each worker calculates the iteration data for a given line of the final image at a time. The workers delegate to functions written in WebAssembly script and write their results to shared memory.
  2. Colourisation - a WebAssembly non-shared memory is constructed to back an ImageData object. The iteration data is copied into this memory and colourised by another WebAssembly based function. The ImageData object is rendered directly onto an HTML canvas.

This two phase implementation allows the re-colourisation of images without needing to regenerate them at the expense of approximately twice the memory overhead.

Running (development)

npm start

Running (optimised production build)

npm run serve

Testing

npm test

Links

Future Work

  • Add some other fractals: Newton, ....
  • Cursor keys for movement (ditch the inputs?).
  • Implementing BigInts in WASM for 'infinite' scrolling?
  • Optimised rendering using the simply connected property of the Mandlebrot set.
  • More interesting colourisation methods.
  • Improve the UI:
    • Maybe full screen (scrollable) image with floating controls (if we keep them at all)?
  • Free hosting.
  • User-friendly image saving (with details on the extents maybe).
  • Publish the WebAssembly script modules as proper dependencies.
  • Handle (resource construction) errors conditions properly

Queries

  • In CanvasHelper.canvasCursorLocation, why do we need to use the min and floor function?

Version History

See Version History

Licensing

The Unlicense

About

React Mandlebrot Renderer

Resources

License

Stars

Watchers

Forks

Packages

No packages published