Mandelbrot Set Demo

Introduction

This application demonstrates advantages of parallel execution done using Java Parallel API.

About

This JavaFX application renders an image using Mandelbrot set (wikipedia link) for any particular range of complex values.

Given a complex number the algorithm calculates an integer value which is then mapped to a color. Real part of a complex value is mapped to horizontal axis of the screen. Imaginary part of a complex value is mapped to a vertical axis of the screen.

Navigation

Details

MandelbrotSetTask.call() method contains code which is equivalent to the following when running in parallel mode:

IntStream.range(0, height).parallel().forEach((int y) -> {
    for (int x = 0; x < width; x++) {
        // calculate (x, y) pixel color 
    }
});

Command line options

    java -jar MandelbrotSet.jar -min <minReal>,<minImaginary> -max <maxReal>,<maxImaginary> -windowSize <width>x<height>

Here is an example produced by typing "I" inside the app:

Use the following parameters to get to the same position
-min -2.4807381162845332,-1.3061943784663503
-max 0.9781413692299719,1.2879652356695286
-windowSize 800.0x600.0;    

Source code