https://github.com/hakolao/fractal_explorer
A fractal explorer tool with image export
https://github.com/hakolao/fractal_explorer
Last synced: 21 days ago
JSON representation
A fractal explorer tool with image export
- Host: GitHub
- URL: https://github.com/hakolao/fractal_explorer
- Owner: hakolao
- Created: 2020-02-03T15:39:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-07T09:55:42.000Z (about 5 years ago)
- Last Synced: 2025-04-02T09:23:57.105Z (6 months ago)
- Language: C
- Homepage:
- Size: 24.5 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fractal explorer (Fractol)
A multi-threaded fractal explorer with image export & adjustable smooth colors.
## Features
- Multithreaded
- Zooming in with mouse scroll
- Moving towards mouse when zooming
- Panning with arrows
- Centering to mouse position on click
- Multiple Julia & Mandelbrot style fractals (9 in total)
- Mouse movement controls for Julia fractals
- Adjustable color palette & color palette size
- Adjustable colors via command line arguments
- Random colors though in the range of currently used colors
- Smooth colors
- Adjustable max iteration limit
- Adjustable powers (`z^pow`) on `mandelbrot_n` & `julia_n`
- High resolution `.bmp` image export
- Debugging UI displaying positional info & color palette (Toggle with `G`)
- Multiple windows, can open all fractals simultaneously
## Usage
```sh
git clone https://github.com/hakolao/fractal_explorer.git && cd fractal_explorer && make
# Default usage
./fractol
```
```sh
usage:
./fractol [fractal_name] -colors=[r,g,b\|r,g,b\|+]fractals:
all (opens all)
mandelbrot (Default)
julia
burning_ship
mandelbrot_n
julia_n
bird_of_prey
julia_mod
phoenix_mod
burning_juliaexample:
./fractol mandelbrot julia -colors=255,0,0\|0,255,0\|0,0,255more options:
ESC to exit
G for guide & further actions on screen.
--------------------------------------------------------------------------------
```Some favorites:
```
./fractol phoenix_mod -colors=255,255,255\|255,0,0\|0,0,255
./fractol phoenix_mod -colors=0,0,0\|255,0,0\|0,0,255
```
Three colors work quite well & randomizing given values with button `C` makes it quite nice.
The randomizer only randomizes colors of given inputs that were larger than 0. So it keeps
the palette similar to what it was in the beginning. E.g.`255,255,255` will be totally random after clicking `C`, but
`255,0,0` will be `rand() % 255, 0, 0`.
Remember to increase the iterations on especially Julia type fractals with `2` & `1` to increase definition.
### Headers
Edit following macros in the `fractol.h` header file.
Note that with current design `HEIGHT / THREADS` should have no remainder.
`HEIGHT % THREADS` should be `0.`
```
// Resolution
# define WIDTH 1080
# define HEIGHT 1080// Export image resolution
# define IMG_WIDTH 4096
# define IMG_HEIGHT 4096// Thread number
# define THREADS 8
```

## Notes
This project was made as part of the graphics branch in Hive Helsinki.
Therefore the code follows 42's strict norms:
- Functions must not exceed 25 lines
- Max 5 functions in a .c file
- Cannot stick variable declaration and initialization on the same line
- Max 5 variables per block
- Max 4 parameters per function
- Forbidden keywords: `for`, `do ... while`, `switch`, `case`, `goto`Only existing C functions `exit`, `open`, `close`, `write`, `read`, `malloc`, `free`, and the functions of `minilibx (libmlx)` and `math.h` are allowed. Although other functions may be used in bonus features. Image export in this project's case used `fopen`, `fwrite` & `fclose`.





