Skip to content

daelsepara/sdl-fractals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fractal Image Generators in SDL

GitHub Repository

https://github.com/daelsepara/sdl-fractals

Building (Unix/Linux)

cd repository/src
make

Dependencies: sdl2, sdl2-image

Usage

./Fractals.exe /PARAMS={parameters.json} /IMAGE={image.png} /PALETTE={palette.json} /BENCHMARK {other parameters}

Required parameters

/PARAMS={parameters.json} or /PARAMETERS={parameters.json}

Read parameters from {parameters.json} file.

See parameters/ for sample parameter files.

Optional parameters

/IMAGE={image.png}

Save fractal to {image.png}

/PALETTE={palette.json}

Use {palette.json} colormap. See palettes/ for some colormaps that can be used.

/BENCHMARK

Generate fractal in memory without rendering on the screen or saving image to {image.png}

Without /BENCHMARK and /IMAGE, the fractal is rendered on the screen.

Other parameters

/INVERTX

Inverts x-axis. Left to right goes from + to - values.

/INVERTY

Inverts y-axis. Top to bottom goes from - to + values.

/INVERT

Inverts color values.

/LOG

Use log-scale color mapping. Overrides color mapping in parameter file.

/NORMALIZED

Use normalized color mapping. Overrides color mapping in parameter file.

/MOD

Use moduluo-255 color mapping. Overrides color mapping in parameter file.

/HISTOGRAM

Use histogram color mapping. Overrides color mapping in parameter file.

/DEFAULT

Use default color mapping. Overrides color mapping in parameter file.

Examples

Mandelbrot Set

Mandelbrot Set

Parameters

Generator z^exp + C
exponent 2
max iterations 255
escape value 4.0
parameter files mandelbrot, mandelbrot2, mandelbrot3
palette default
source(s) Mandelbrot.hpp, Mandelbrot2.hpp, Mandelbrot3.hpp

Benchmarks

mandelbrot

Time (mean ± σ):     474.8 ms ±   7.7 ms    [User: 450.3 ms, System: 17.9 ms]
Range (min … max):   460.1 ms … 484.7 ms    10 runs

mandelbrot2

Time (mean ± σ):     382.1 ms ±   7.6 ms    [User: 359.3 ms, System: 17.4 ms]
Range (min … max):   375.8 ms … 401.5 ms    10 runs

mandelbrot3

Time (mean ± σ):     390.9 ms ±  11.6 ms    [User: 365.0 ms, System: 18.2 ms]
Range (min … max):   376.6 ms … 411.8 ms    10 runs

Newton

Newton

Parameters

Generator z - (z^3 - 1)/(3z^2)
tolerance 1e-6
max iterations 255
parameter file newton1
palette default
source Newton1.hpp
Time (mean ± σ):     868.1 ms ±   8.0 ms    [User: 822.9 ms, System: 35.2 ms]
Range (min … max):   855.1 ms … 882.9 ms    10 runs

Julia Sets

Common Parameters

Generator z^exp + C
max iterations 255
escape value 4.0
source Julia.hpp

Specific Parameters and Benchmarks

Julia 1

C -0.4 + 0.6i
parameter file julia1
palette magma
Time (mean ± σ):     821.6 ms ±   8.3 ms    [User: 770.7 ms, System: 38.7 ms]
Range (min … max):   812.3 ms … 836.7 ms    10 runs

Julia 2

C -0.8 + 0.156i
parameter file julia2
palette inferno
Time (mean ± σ):     936.7 ms ±  10.5 ms    [User: 881.0 ms, System: 39.5 ms]
Range (min … max):   925.1 ms … 959.9 ms    10 runs

Julia 3

C 0.285 + 0.01i
parameter file julia3
palette moreland
Time (mean ± σ):     732.1 ms ±  12.2 ms    [User: 678.0 ms, System: 38.8 ms]
Range (min … max):   718.5 ms … 755.8 ms    10 run

Julia 4

C -0.7269 + 0.1889i
parameter file julia4
palette magma
Time (mean ± σ):      1.224 s ±  0.019 s    [User: 1.166 s, System: 0.041 s]
Range (min … max):    1.201 s …  1.263 s    10 runs

Julia 5

C 0.26294324588 - 0.0024215732998i
max iterations 320
normalized colormap true
parameter file julia5
palette inverted jet
Time (mean ± σ):      3.495 s ±  0.027 s    [User: 3.428 s, System: 0.039 s]
Range (min … max):    3.454 s …  3.544 s    10 runs

Mandelbrot4

Mandelbrot 4

Parameters

Generator z^exp + C
exponent 4
max iterations 255
escape value 4.0
parameter file mandelbrot4
palette default
source Mandelbrot.hpp
Time (mean ± σ):      3.937 s ±  0.055 s    [User: 3.831 s, System: 0.056 s]
Range (min … max):    3.898 s …  4.063 s    10 runs

Burning Ship

Burning Ship

Parameters

Generator (Re(Zn) + iIm(Zn))^2 + C
inverted x true
inverted y true
normalized colormap true
inside color 0
max iterations 100
escape value 4.0
parameter file burningship
palette hot
source Mandelbrot.hpp
Time (mean ± σ):     559.9 ms ±   4.1 ms    [User: 518.1 ms, System: 33.7 ms]
Range (min … max):   552.8 ms … 567.2 ms    10 runs

Burning Ship (2)

Burning Ship 2

Parameters

Generator (Re(Zn) + iIm(Zn))^2 + C
inverted x true
inverted y true
log colormap true
inside color 0
max iterations 100
escape value 4.0
parameter file burningship2
palette plasma
source Mandelbrot.hpp
Time (mean ± σ):      1.469 s ±  0.289 s    [User: 0.840 s, System: 0.054 s]
Range (min … max):    1.248 s …  2.128 s    10 runs

Burning Ship (3)

Burning Ship 3

Parameters

Generator (Re(Zn) + iIm(Zn))^2 + C
inverted x true
inverted y true
log colormap true
inside color 0
max iterations 100
escape value 4.0
parameter file burningship3
palette bluered
source Mandelbrot.hpp
Time (mean ± σ):      1.469 s ±  0.289 s    [User: 0.840 s, System: 0.054 s]
Range (min … max):    1.248 s …  2.128 s    10 runs

Tricorn

Tricorn

Parameters

Generator (z_x^2 + z_y^2) - i(2 * z_x * z_y) + C
inside color 0
max iterations 255
escape value 4.0
parameter file tricorn
palette parula
source Tricorn.hpp
Time (mean ± σ):     575.8 ms ±  21.6 ms    [User: 528.1 ms, System: 36.5 ms]
Range (min … max):   536.0 ms … 602.0 ms    10 runs

Multicorn

Multicorn

Parameters

Generator Z_bar^exp + C
exponent 4
inside color 0
max iterations 255
escape value 4.0
parameter file multicorn
palette viridis
source Mandelbrot.hpp
Time (mean ± σ):      1.316 s ±  0.016 s    [User: 1.261 s, System: 0.040 s]
Range (min … max):    1.293 s …  1.346 s    10 runs

Barnsley Fern

Barnsley Fern

Parameters

Generator (xn) xn = xx * x + xy * y + xc (see below)
Generator (yn) yn = yx * x + yy * y + yc (see below)
inside color 128
max iterations 10000000
parameter file barnsleyfern
palette green
source IteratedFunctionSystem.hpp

Generator

Probability Transformation [ xx xy yx yy xc yc ]
p < 0.01 [ 0.000 0.000 0.000 0.160 0.000 0.000 ]
p < 0.86 [ 0.850 0.040 -0.040 0.850 0.000 1.600 ]
p < 0.93 [ 0.200 -0.260 0.230 0.220 0.000 1.600 ]
p < 1.00 [ -0.150 0.280 0.260 0.240 0.000 0.440 ]
Time (mean ± σ):     664.8 ms ±   9.4 ms    [User: 621.5 ms, System: 33.5 ms]
Range (min … max):   648.1 ms … 676.3 ms    10 runs

Barnsley Fern (Culcita)

Barnsley Fern

Parameters

Generator (xn) xn = xx * x + xy * y + xc (see below)
Generator (yn) yn = yx * x + yy * y + yc (see below)
inside color 128
max iterations 10000000
parameter file culcita
palette green
source IteratedFunctionSystem.hpp

Generator

Probability Transformation [ xx xy yx yy xc yc ]
p < 0.02 [ 0.000 0.000 0.000 0.250 0.000 -0.140 ]
p < 0.86 [ 0.850 0.020 -0.020 0.830 0.000 1.000 ]
p < 0.93 [ 0.090 -0.280 0.300 0.110 0.000 0.600 ]
p < 1.00 [ -0.090 0.280 0.300 0.090 0.000 0.700 ]
Time (mean ± σ):     637.9 ms ±  32.5 ms    [User: 583.6 ms, System: 33.9 ms]
Range (min … max):   589.1 ms … 683.9 ms    10 runs

Barnsley Fern (Thelypteridaceae)

Barnsley Fern

Parameters

Generator (xn) xn = xx * x + xy * y + xc (see below)
Generator (yn) yn = yx * x + yy * y + yc (see below)
inside color 128
max iterations 10000000
parameter file thelypteridaceae
palette green
source IteratedFunctionSystem.hpp

Generator

Probability Transformation [ xx xy yx yy xc yc ]
p < 0.02 [ 0.000 0.000 0.000 0.250 0.000 -0.400 ]
p < 0.86 [ 0.950 0.005 -0.005 0.930 -0.002 0.500 ]
p < 0.93 [ 0.035 -0.200 0.160 0.040 -0.090 0.020 ]
p < 1.00 [ -0.040 0.200 0.160 0.040 0.083 0.120 ]
Time (mean ± σ):     572.3 ms ±   8.5 ms    [User: 533.0 ms, System: 31.7 ms]
Range (min … max):   562.6 ms … 590.9 ms    10 runs

Sierpinski Carpet

Sierpinski Carpet

Parameters

Generator (xn) xn = xx * x + xy * y + xc (see below)
Generator (yn) yn = yx * x + yy * y + yc (see below)
inside color 128
max iterations 10000000
parameter file sierpinski-carpet
palette sand
source IteratedFunctionSystem.hpp

Generator

Probability Transformation [ xx xy yx yy xc yc ]
p < 0.125 [ 0.33 0.00 0.00 0.33 -0.66 0.66 ]
p < 0.250 [ 0.33 0.00 0.00 0.33 0.00 0.66 ]
p < 0.375 [ 0.33 0.00 0.00 0.33 0.66 0.66 ]
p < 0.500 [ 0.33 0.00 0.00 0.33 -0.66 0.00 ]
p < 0.625 [ 0.33 0.00 0.00 0.33 0.66 0.00 ]
p < 0.750 [ 0.33 0.00 0.00 0.33 -0.66 -0.66 ]
p < 0.875 [ 0.33 0.00 0.00 0.33 0.00 -0.66 ]
p < 1.000 [ 0.33 0.00 0.00 0.33 0.66 -0.66 ]
Time (mean ± σ):     429.3 ms ±  31.5 ms    [User: 402.7 ms, System: 18.1 ms]
Range (min … max):   393.0 ms … 472.3 ms    10 runs

Sierpinski Triangle

Sierpinski Triangle

Parameters

Generator (xn) xn = xx * x + xy * y + xc (see below)
Generator (yn) yn = yx * x + yy * y + yc (see below)
inside color 128
max iterations 10000000
parameter file sierpinski-triangle
palette inverted gnpu
source IteratedFunctionSystem.hpp

Generator

Probability Transformation [ xx xy yx yy xc yc ]
p < 0.33 [ 0.50 0.00 0.00 0.50 -0.50 -0.50 ]
p < 0.66 [ 0.50 0.00 0.00 0.50 0.00 0.50 ]
p < 1.00 [ 0.50 0.00 0.00 0.50 0.50 -0.50 ]
Time (mean ± σ):     377.3 ms ±  26.8 ms    [User: 353.2 ms, System: 16.8 ms]
Range (min … max):   350.7 ms … 432.0 ms    10 runs

Other Examples

Tree

Tree Parameters: tree

Seaweed

Seaweed Parameters: seaweed

Julia (Dragon)

Julia Dragon Parameters: julia-dragon

Julia (Siegel Disk)

Julia Siegel Disk Parameters: julia-siegel

Julia (Flower)

Julia Flower Parameters: julia-flower

Mandelbrot (Histogram coloring)

Mandelbrot Histogram Parameters: mandelbrot-histogram

Chrysantemum (Julia)

Chrysantemum Parameters: chrysantemum

Cross Snowflakes

Cross Snowflakes Parameters: cross-snowflakes

Crystal

Crystal Parameters: crystal

Dendrite (Julia)

Dendrite Parameters: dendrite

EKG (Julia)

EKG Parameters: ekg

Snowflakes (Julia)

Snowflakes Parameters: julia-snowflakes

Sine (Julia)

Sine Parameters: julia-sin

Cosine (Julia)

Cosine Parameters: julia-cos

Dragon Curve

Dragon Curve Parameters: dragon-curve

Julia (1/z|Conjugate)

Julia (1/z|Conjugate) Parameters: julia-funcs

Julia (c * fn(z))

Julia (c * fn(z) Parameters: julia-func

Julia 6

Julia 6 Parameters: julia6

Koch Curve

Koch Curve Parameters: koch

Koch Triangle

Koch Triangle Parameters: koch-triangle

Koch (Mix)

Koch (Mix) Parameters: kochmix

Leaf

Leaf Parameters: leaf

Leaf 2

Leaf 2 Parameters: leaf2

Levy Curve

Levy Curve Parameters: levy-curve

Mandelbrot (Sine)

Mandelbrot (Sine) Parameters: mandelbrot-func

Mandelbrot (Sqr|Cos)

Mandelbrot (Sqr|Cos) Parameters: mandelbrot-funcs

Mandelbrot (1/z^4)

Mandelbrot (1/z^4) Parameters: mandelbrot-reciprocal

Maple

Maple Parameters: maple

Pascal Hadamard

Maple Parameters: pascal-hadamard

Pentagon

Pentagon Parameters: pentagon

Mandelbrot sinh^2(z)

Mandelbrot sinh^2(z) Parameters: sinh

Snowflakes

Snowflakes Parameters: snowflakes

Tree 2

Tree2 Parameters: tree2

Newton

Newton Parameters: newton

Newton IV

Newton IV Parameters: newton4

Barnsley Tree

Barnsley Tree Parameters: barnsleytree

Biomorphs

Biomorph M (Mandelbrot)

Biomorph (Mandelbrot) Parameters: biomorph-mandelbrot

Biomorph 1 (Julia)

Biomorph (Julia) Parameters: biomorph-julia

Biomorph 2 (Julia)

Biomorph (Julia) Parameters: biomorph-julia2

Biomorph 3 (Julia)

Biomorph (Julia) Parameters: biomorph-julia3

Biomorph 4 (Julia)

Biomorph (Julia) Parameters: biomorph-julia3

Biomorph 5 (Julia)

Biomorph (Julia) Parameters: biomorph-julia5

Biomorph 6 (Julia)

Biomorph (Julia) Parameters: biomorph-julia6

Biomorph 7 (Julia)

Biomorph (Julia) Parameters: biomorph-julia7

Biomorph 8 (Julia)

Biomorph (Julia) Parameters: biomorph-julia8