Fractol is a captivating computer graphics exploration project that delves into the beauty and complexity of fractals. Developed using the C programming language and the MiniLibX library, this project renders stunning visual representations of the Julia and Mandelbrot fractal sets. Beyond being a visual spectacle, Fractol serves as a practical application of complex numbers, graphics optimization, and event handling in graphics programming.
To install Fract'ol, follow these steps:
git clone https://github.com/oumimoun/fractol.git
cd fractol
make
Ensure that the MiniLibX library is installed on your system before compiling.
Run the program with the following command:
./fractol [fractal-type]
Replace [fractal-type] with either M for Mandelbrot or J for Julia to view the respective fractal set.
# Generate Mandelbrot set
./fractol M
# Generate Julia set with custom parameters
./fractol J 0.5646454 0.954
Fractal geometry is a branch of mathematics that studies complex shapes and structures exhibiting self-similarity at different scales. A fractal is a geometric pattern or object that repeats itself at varying levels of magnification. The defining characteristic of fractals is their ability to replicate similar structures infinitely within a finite space.
The Mandelbrot set is a set of complex numbers in the complex plane, defined by iterating a simple mathematical expression. The set is named after the mathematician Benoît B. Mandelbrot. The mathematical expression for determining whether a complex number c
belongs to the Mandelbrot set is:
Zn+1 = (Zn)^2 + c
where Z0 = 0
. The iteration continues, and if the magnitude of Zn
remains bounded (does not become infinitely large) for all iterations, then the complex number c
is considered part of the Mandelbrot set. In mathematical terms:
∣Zn∣ ≤ 2 for all n
If |Zn|
exceeds 2 at any iteration, c
is not part of the Mandelbrot set. The Mandelbrot set is often visualized in the complex plane, with different colors or shades representing whether a point is inside or outside the set based on the number of iterations required for the magnitude to exceed 2.
The Julia set is another set of complex numbers in the complex plane, defined through iteration of a specific mathematical expression. The Julia set is associated with a fixed complex number c
, and the iteration is determined by the following mathematical expression:
Zn+1 = (Zn)^2 +c
where Z0
is the initial complex number. Similar to the Mandelbrot set, the iteration continues, and if the magnitude of Zn
remains bounded (does not become infinitely large) for all iterations, then Z0
is considered part of the Julia set associated with the fixed c
. In mathematical terms:
∣Zn∣ ≤ 2 for all n
If Zn
exceeds 2 at any iteration, Z0
is not part of the Julia set. The Julia set exhibits intricate and complex fractal patterns, and different Julia sets can be generated by varying the fixed complex number c
.
Certainly! Complex numbers are numbers that have both a real part and an imaginary part. A complex number is typically represented in the form a + bi
, where a
is the real part, b
is the imaginary part, and i
is the imaginary unit, defined as the square root of -1.
Mathematically, a complex number z
is expressed as:
z = a + bi
Here,
a
is the real part,b
is the imaginary part,i
is the imaginary unit (i^2 = -1
).
Complex numbers are fundamental in mathematics and are widely used in various fields, including physics and engineering, to represent quantities with both magnitude and direction.