A beautiful fractal visualization program built with MiniLibX graphics library. This project allows you to explore and interact with various mathematical fractals in real-time.
Note
This version is specifically built for macOS and uses the MiniLibX graphics library. The program provides an interactive way to explore the fascinating world of mathematical fractals with real-time zooming and panning capabilities.
- Mouse Wheel: Zoom in/out at cursor position
- Arrow Keys: Pan the view in all directions
- ESC Key: Exit the program
- SHIFT Key: Increase iteration count for higher detail (bonus feature)
- TAB Key: Additional control options
- macOS (this version is specifically built for macOS)
- GCC compiler
- MiniLibX library (included in the project)
# Clone the repository
git clone <repository-url>
cd fractol
# Build the project
make# Run Mandelbrot set
./fractol mandelbrot
# Run Julia set with default parameters
./fractol julia
# Run Julia set with custom parameters (between -2.0 and 2.0)
./fractol julia 0.3 -0.56
# Run Tricorn set
./fractol tricorn
# Run Burning Ship set
./fractol burning_ship- For Julia sets, parameters must be within the range [-2.0, 2.0]
- Parameters are automatically converted from string to double precision
fractol/
├── srcs/ # Source files
│ ├── main.c # Main program entry point
│ ├── fractal_draws.c # Fractal calculation algorithms
│ ├── window_management.c # Window and event handling
│ ├── configure_fractal.c # Fractal configuration and rendering
│ ├── error_management.c # Input validation and error handling
│ └── characters_into_double.c # String to double conversion
├── inc/ # Header files
│ └── fractol.h # Main header with all definitions
├── mlx/ # MiniLibX graphics library
├── utils/ # Utility libraries
│ └── ft_printf/ # Custom printf implementation
├── Makefile # Build configuration
├── Mandelbrot.gif # Mandelbrot set demonstration
├── Julia_set.gif # Julia set demonstration
└── README.md # This file
- MiniLibX: A minimal graphics library for macOS
- Window Size: 500x500 pixels
- Coordinate System: Cartesian plane from (-2, -2) to (2, 2)
- Color System: RGB color mapping based on iteration count
- Iteration Limit: Configurable (default: 1000 iterations)
- Precision: Double precision floating-point calculations
- Zoom: Infinite zoom capability with mouse wheel
- Panning: Smooth movement with arrow keys
- Proper cleanup on program exit
- No memory leaks
- Efficient image buffer management
draw_mandelbrot(): Renders the Mandelbrot setdraw_julia(): Renders Julia sets with custom parametersdraw_tricorn(): Renders the Tricorn fractaldraw_burningship(): Renders the Burning Ship fractal
manage_key(): Handles keyboard inputmouse_hook(): Handles mouse interactionsclose_red_cross(): Handles window closing
ft_atod(): Converts ASCII strings to double precisioncolor_fractal(): Maps iteration count to RGB colorsmap(): Scales values between coordinate systems
The program uses a dynamic color scheme where:
- Colors are mapped based on the number of iterations
- Higher iteration counts result in different color gradients
- The color mapping creates beautiful visual patterns
The program includes comprehensive error handling for:
- Invalid command line arguments
- Out-of-range parameters for Julia sets
- Missing or incorrect fractal names
- Proper cleanup on errors
./fractol mandelbrot
./fractol julia 0.285 0.01
./fractol julia -0.4 0.6
./fractol tricorn
./fractol burning_shipThe program provides helpful error messages when invalid input is provided, including examples of correct usage.
make # Build the project
make clean # Remove object files
make fclean # Remove object files and executable
make re # Rebuild the project from scratchNote
This version is specifically built for macOS and uses the MiniLibX graphics library. The program provides an interactive way to explore the fascinating world of mathematical fractals with real-time zooming and panning capabilities.



