Code Monkey home page Code Monkey logo

pyifs's Introduction

Iterated Function System Renderer in Python

This program randomly generates IFS fractal images using the chaos game and linear tone mapping.

Initially written in Python 2 under the guidance of Thomas Ludwig one night at KiwiFoo. The tone-mapped image handling comes from Minilight. Restructuring, port to Python 3, and additional transforms by Jezza Hehn. Most of the additional transforms have been converted from Scott Draves' original paper on fractal flames.

NOTE: While this will run in standard Python 3, using PyPy3 will be about 40x faster.

Installing

You will need to install PyPy3, as well as the modules colour, click, numpy, and zlib using PyPy3's pip. Please see this page for further details.

Running

Just run

pypy3 pyifs.py

NOTE: If you get a nice result, the random seed is saved as a large integer in the image filename. If you wish to re-render at a different resolution, pass this seed to the IFSI constructor instead of a new random integer.

Customization

Parts of the code that can be customized are as follows:

  • You can adjust the width, height, iterations, num_points, num_transforms, moebius_chance, and image_count in the file config.py
  • You can write new Transform or ComplexTransform classes in transforms.py

Writing New Transforms

A new subclass of Transform should randomize its parameters in __init__ then implement a transform method that takes two args (the x, y of the point) and returns a new x, y.

Alternatively, you can subclass ComplexTransform. Instead of implementing transform, implement a method f that takes a single complex number argument and returns a new complex number.

Examples

example IFS 1 example IFS 2 example IFS 3 example IFS 4

pyifs's People

Contributors

jezzahehn avatar jtauber avatar

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.