This repository contains the code for the Fract-ol project, including both mandatory and bonus parts.
The fract-ol project from the 42 School is one of the three "beginner" graphical projects of the cursus. It teaches you about manipulating a low-level graphic library, advanced math, and more.
A fractal is an infinitely complex pattern that repeats at different scales, created through a simple, recursive process.
These patterns, often linked to chaos, exist between familiar dimensions. Fractals are common in nature, appearing in trees,
rivers, coastlines, mountains, clouds, and hurricanes.
Abstract fractals, like the Mandelbrot Set, can be generated by computers through repeated calculations of equations.
The program is written in C language and thus needs the gcc compiler and some standard C libraries to run. In addition to that, you will need the MinilibX library, of course.
Note
In accordance with the 42 School coding norms:
- Each function must not exceed 25 lines of code.
- Every variable should be declared at the top of the function and initialized on a separate line.
- Only allowed functions may be used—using others is considered cheating.
-
Clone the repository
git clone https://github.com/AnaVolkmann/42_FRACTOL.g
-
To compile the program, run the following command
make
-
To execute the program, use the following command
./fractol <fractal>
Available commands:
mandelbrot,julia.
The program supports the following controls:
| Mouse Scroll | Zoom |
| ⬆️ ⬇️ ⬅️ ➡️ | Move the view |
| SHIFT | Shift the color range |
| - and + | Decrease or increase the max iterations |
| SPACE | Generate new constants for the Julia fractal |
| ESC | Close the program window |
🚀 The lower the iterations, the faster the program will run. 🐢 The deeper the zoom, the more iterations are needed to render the fractal, the slower the program.
Fractals are formed by mathematical suites.
For example, the Julia and Mandelbrot sets are defined by the following suite:
Fractals are based on complex numbers (i.e. numbers with a real and imaginary part, like
-
The
$a$ (real) part of the complex number is represented on a x-axis. -
The
$b$ (imaginary) part of the complex number is represented on a y-axis. -
This means that the coordinates
$(3, 7)$ represent number$z = 3 + 7i$ , and that every pixel of a window can be used to represent a complex number. -
Every complex number put into the suite will either:
- converge to a finite number
- diverge to infinity.
-
The pixels of the window can be colored depending on whether the complex number they represent converges or diverges.



