Creating Fractals using Chaos Game, written in C++ and SFML
YouTube : https://youtu.be/8pyCVVWE1LI
Chaos Game is a method of creating Fractals, using polygons and an intial random point inside it. A random vertex is chosen and the starting/initial point is moved in that direction in some fraction knowns as distance factor(like 1/3, 1/2 etc).
Taking this new position as current and choosing random vertex again and moving towards it depending on the distance factor, doing this iteratively produces a fractal.
This code shows fractals related to n-flake thoery, where n is the number of vertices and if the necessary distance factor is given produces a nice fractal flake.
Install SFML
Install make (command : sudo apt install make
)
Run command : make F1=main.cpp
The program expects two inputs
- The number of vertices
- The distance factor
This is a Sierpinski Triangle, it is an n-flake, where n is 3 and the distance factor is 1/2 or 0.5.