This C code generates a Julia set fractal image and saves it as a BMP file. It utilizes multithreading for parallel processing to enhance performance.
Ensure you have a C compiler installed to build and run the program.
Compile the code using the following command:
gcc multithreadedJuliaSet.c -o julia_set_renderer -lm -pthread
Run the compiled executable:
./julia_set_renderer
This will generate an image file named img.bmp
in the same directory.
Adjust the parameters in the juliaInputs
structure within the main
function to explore different Julia sets:
c
: Complex constant determining the Julia set shape.minX
,maxX
,minY
,maxY
: Define the region of the complex plane to render.density
: Density of points in the complex plane.maxRadius
: Maximum radius to consider for iteration.maxIter
: Maximum number of iterations for each point.oversample
: Level of oversampling for smoother images.
The code uses pthreads to parallelize the rendering process, enhancing efficiency, especially for large images.
The resulting image is saved as img.bmp
with a BMP file header created using the bmpHeader
function.
Feel free to experiment with the code and customize the Julia set by adjusting parameters!