Coder Social home page Coder Social logo

chaosgame's Introduction

Chaos Game

A chaos game generation library. Supports Jupyter Notebook.

Features

  • Create 2D and 3D fractals with chaos game
  • Animate creation of chaos game fractals

Install

Requirements

  • GEOS
    • Available on MacOS, Windows, Linuxes

Recommended method

  1. Clone the repository.
  2. Install from requirements.txt by pip install -r requirements.txt.

Alternative method

pip install chaosgame

pip might not be updated.

Jupyter Notebook

View 3D chaos games (WIP)

Interactive 3d chaos game in Jupyter Notebook by ipyvolume.

2D samples

from chaosgame.chaos_game import *

The famous Sierpiński triangle

# 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()

Sierpinski carpet

cg = ChaosGameRegularPolygon(4)
cg.add_virtual_vertex(1)
cg.chaos_game(10000, 2/3)
cg.generate_heatmap()

Vicsek fractal

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.