My solution for a school assignement, writing a Koch fractal generator in C.
This code generates images in the ppm format. You can choose the number of sides of the figure, as well as generate enough images to make gifs !
These instructions will let you run the code and generate as many Koch snowflakes as you'd like.
Installed on your computer :
gcc or clang
As well as a way to display ppm images (a web browser or most image viewers will work).
Just type make
in your terminal.
The syntax is the following :
./koch <size> <number of sides> <number of iterations> <foreground color> <background color> <file name> [all]
- is the size in pixels of the first segment. We deduce the size of the image from it.
- is the number of segments in the polygon (3 = triangle, etc).
- is the number of times the algorithm will be ran ("depth" of the fractal).
- is the color used for the lines, writen in 0x**RRGGBB hex format.
- is the color of the background, written in the same format.
- is the name of the output image.
- [all] : when added, every step of the fractal generation will be saved.
- Jules Simon - Initial work - Smoltbob
This project is licensed under the MIT License - see the LICENSE.md file for details
- Ensimag school for giving the assignement.