Skip to content

42 School Fractol project: Fractal generator using MLX library.

License

Notifications You must be signed in to change notification settings

dpetrosy/42-Fractol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Fractol Project

42 Yerevan Fractol
For further information about 42cursus and its projects, please refer to 42cursus repo.


📜 About Project

One of the first graphical projects at 42 School, fract-ol generates beautiful fractals from the complex numbers of
an iterative mathematical construct. A fractal is a fragmented geometrical figure that infinitely repeats itself at
smaller scales. This project uses the school's graphical library, MiniLibX.

For detailed information, refer to the subject of this project.

🚀 TLDR: The fract-ol project is one of the three "beginner" graphical projects of the 
	 cursus. It teaches you about using graphic library, advanced math, and more.

Note

Because of 42 School norm requirements:

  • Each function can't have more than 25 lines of code.
  • All variables are declared and aligned at the top of each function.
  • Project should be created just with allowed functions otherwise it's cheating.

📑 Fractals List

The program supports these fractal sets:

Name Formula
Mandelbrot $z_{n+1} = z_n^2 + c, z_0 = 0$
Julia $z_{n+1} = z_n^2 + c, z_0 = c$
Burning Ship $z_{n+1} = abs(z_n^2) + c, z_0 = 0$
Tricorn $z_{n+1} = \frac{}{z_n}^2 + c, z_0 = 0$
Mandelbox It's more complex, see this article
Celtic Mandelbar $z_{n+1} = \frac{}{z_n}^2 + c, z_0 = c$

🎮 Controls

The program supports the following controls:

Key Description
ESC Close the program window
Keys [1-6] Move to another fractal
Keys [Q-Y] Change the color of fractal
Keys [A-H] Change the color of fractal
Mouse Scroll Zoom in and out of the fractal
⬆️ ⬇️ ⬅️ ➡️ Change the viewpoint
Key L Lock Julia's fractal
Zero Reset the fractal to its initial state

👨‍💻 Usage

Requirements

The program is written in C language and thus needs the gcc compiler and some standard C libraries to run.

Instructions

1. Compiling the program

To compile the program, run:

$ cd path/to/fractol && make

2. How to run the program

Run the executable too see the help message:

./fractol

Or run with some supported fractal:

./fractol mandelbrot

🌄 Screenshots

Mandelbrot set

Fractal mono-colored Mandelbrot Fractal red blue and green striped Mandelbrot Fractal sun crest purple Mandelbrot

Julia set

Fractal purple green and yellow Julia Fractal red swirl Julia Fractal blue snowflake Julia

Burning Ship set

Fract-ol golden Burning Ship

Tricorn set

Fract-ol purple Tricorn

Mandelbox set

Fract-ol brown tribal Mandelbox