Skip to content

MQH-T/Fractol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by mtran.

Fract-ol

The purpose of this project is to code a mathematical fractal exploration program using the MinilibX graphical library.

Description

Fract-ol is an interactive graphical program that calculates and renders fractals in real-time. It allows users to explore the infinite complexities of the Mandelbrot and Julia sets. The program handles window management, events, and pixel-by-pixel rendering to translate mathematical equations into visual beauty.

Features

  • Real-time rendering of the Mandelbrot and Julia sets
  • Customizable starting parameters for the Julia set via command-line arguments
  • Smooth navigation: zoom in/out with the mouse wheel and pan the camera with arrow keys
  • Custom string-to-float parser (ft_atof) for precise mathematical seeds
  • Clean memory management (0 memory leaks) and smooth window closing

Usage

make

Mandelbrot

To explore the Mandelbrot set:

./fractol Mandelbrot

Mandelbrot

To explore the BurningShip set:

./fractol BurningShip

### Julia

The Julia set requires a constant complex number (a real part and an imaginary part) as a mathematical seed.

```bash
./fractol Julia <real_part> <imaginary_part>

Example:

./fractol Julia -0.8 0.156
./fractol Julia 0.0005487 0.7551111
./fractol Julia -0.4 0.6
./fractol Julia 0.285 0.01
./fractol Julia -0.835 -0.2321
./fractol Julia 0.285 0

How it works

The rendering engine is based on the equation $Z_{n+1} = Z_n^2 + C$. The program determines if a point on the complex plane escapes towards infinity (beyond a radius of 2) after a maximum number of iterations. For Mandelbrot, the starting point $Z_0$ is 0, and the constant $C$ corresponds to the pixel's coordinate on the screen. For Julia, $Z_0$ is the pixel's coordinate, and $C$ is the constant seed provided by the user. The color of each pixel is dynamically calculated based on how many iterations it took for the point to escape.

Sources

AI Usage

Additionally, I used AI tools as an educational assistant to help debug complex issues and refine logic during the development process.

Acknowledgments

Thanks to my fellow 42 students for their help, code reviews and support throughout this project. A special thanks to tgomez-f for the invaluable help with debugging memory leaks! Peer-learning and collaboration are what make 42 great.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors