A simple Java gui app that creates fractals applying specifics rules to random generated points.
For more information abaout chaos game and fractal visit the Algorithm Archive, the Wikipedia page or the Wolfram one.
Chaos game is a method to create fractals using an initial point selected at random inside a polygon and then applying a rule to find the next point. After some iterations we will often (depending on the rule) start seeing the shape.
This project aim is to create a gui that allows to simple generate fractal using the above method.
The main window allows to select from three polygons (Triangle, Squere, Pentagon) or to create yours (Custom) by choosing the number of sides (wich obviously must be greater then three) and to insert the number of iterations.
You can also select two different rules to generate the points: both of them starts from a random point inside the shape, select a vertex of the polygon and then choose the mid point of the distance between the previous point and the vertex as the new point form wich reiterate this algoritm.
In the first rule (the default one for the triangle) the vertex is choosen randomly, while in the second one (the default for other shapes) is added one condition: it must be different from the previous one.
Main window with default settings for Triangle
![Main window: Default settings](images/Main_Default.png)
Trinagle fractal (also known as Sierpiński triangle)
![Shape window: Trinagle](images/Trinagle.png)
Square fractal
![Shape window: Square](images/Square.png)
Pentagon fractal
![Shape window: Pentagon](images/Pentagon.png)
Main window with custom settings for Esagon
![Main window: Custom settings](images/Main_Custom.png)
Esagon fractal
![Shape window: Esagon](images/Esagon.png)
This project requires:
- Java 11 or newer
To run this project from the commnad line (on Unix systems) follw this steps:
- Clone the reposiory:
git clone [email protected]:akanok/Chaos-Game.git
orgit clone https://github.com/akanok/Chaos-Game.git
- Move into the project folder:
cd Chaos-Game/
- Create bin folder for .class files:
mkdir bin
- Compile java files:
javac -sourcepath src/ -d bin/ src/chaos/game/*.java
- Move into the bin folder:
cd bin/
- Run the app:
java chaos.game.Main
If you prefere you can also create a .jar
and execute it:
- Steps
1
to5
are identically as before - Create
.jar
archive:jar cvfe MyApp.jar chaos/game/Main chaos/game/*
- Run the app:
java -jar MyApp.jar
This project is licensed under MIT.
Please see the LICENSE file for details.