Chaos Game Fractal Generator A simple command-line application written in Rust for generating fractals using the 'Chaos Game' algorithm. Table of Contents Algorithm Description This application generates fractals using the following simple, iterative algorithm: Define the $n$ vertices of a regular polygon Choose a random initial point within the polygon Select one of the polygon's vertices at random Move the current point a specific ratio, $r$ , of the distance towards the chosen vertex Repeat steps 3 and 4 for some large number of iterations, plotting each new point By adjusting the number of vertices, the distance ratio, and optionally adding additional restrictions to the choice of vertices, a huge variety of intricate fractal patterns can be generated. More details on the algorithm can be found here. Gallery Below are some example fractals generated with this application. Fractal Parameters Image Sierpiński Triangle $n=3$ , $r=0.5$ Rainbow Hex Fractal $n=6$ , $r=0.5$ Spirals Fractal $n=5$ , $r=0.5$ , Rule: Cannot pick the same vertex twice in a row. Star Fractal $n=5$ , $r=0.5$ , Rule: If a vertex is picked twice in a row, the next pick cannot be a direct neighbour of it. Installation and Usage To use the application, you can simply install it using Cargo: cargo install chaos-game You can then run it from the command line, providing arguments to customise the generated fractal. Basic Example This basic example generates the Sierpiński triangle, one of the most well-known fractals produced by the Chaos Game. chaos-game -n 3 -r 0.5 -o sierpinski.png Command-Line Arguments You can see all available options by running the application with the --help flag. Option Short Flag Description Default Value --sides -n The number of sides of the fractal polygon. 3 --ratio -r The distance ratio for point interpolation (0.0 to 1.0). 0.5 --iterations -i The total number of iterations to run the algorithm for. 100,000,000 --output -o The output filename for the final PNG image. o...
First seen: 2025-09-06 23:37
Last seen: 2025-09-07 10:39