A chaos game generation library. Supports Jupyter Notebook.
- Create 2D and 3D fractals with chaos game
- Animate creation of chaos game fractals
- GEOS
- Available on MacOS, Windows, Linuxes
- Clone the repository.
- Install from
requirements.txt
bypip install -r requirements.txt
.
pip install chaosgame
pip might not be updated.
Interactive 3d chaos game in Jupyter Notebook by ipyvolume.
from chaosgame.chaos_game import *
# create regular polygon object with 3 vertexes (triangle)
cg = ChaosGameRegularPolygon(3)
# start chaos game with 10000 iterations and factor 0.5
cg.chaos_game(100000, 0.5)
# generate heatmap
cg.generate_heatmap()
cg = ChaosGameRegularPolygon(4)
cg.add_virtual_vertex(1)
cg.chaos_game(10000, 2/3)
cg.generate_heatmap()
You can even apply additional vertexes (points randomly picked during chaos game). In this case, a vertex is created in the center of the polygon.
cg = ChaosGameRegularPolygon(4)
# create an additional vertex
cg.add_virtual_vertex(0)
cg.chaos_game(100000, 2/3)
cg.generate_heatmap()