Giter Site home page Giter Site logo

ifs's Introduction

IFS - Iterated function system

What is it?

Iterated function systems or IFSs are a method of constructing fractals; the resulting constructions are always self-similar. IFS fractals, as they are normally called, can be of any number of dimensions, but are commonly computed and drawn in 2D. The fractal is made up of the union of several copies of itself, each copy being transformed by a function (hence "function system"). The canonical example is the Sierpinski gasket also called the Sierpinski triangle. The functions are normally contractive which means they bring points closer together and make shapes smaller. Hence the shape of an IFS fractal is made up of several possibly-overlapping smaller copies of itself, each of which is also made up of copies of itself, ad infinitum. This is the source of its self-similar fractal nature. (more from Wikipedia: http://en.wikipedia.org/wiki/Iterated_function_system )

What is this Project?

This project is a implementation of a kind of IFS. Each system is a stochastic composition of two-dimensional linear functions.

Why?

I wanted to learn more about these beautiful fractal like mathematical structures.

The system are configured by json files, e. g.:

{
    "iterations": 28,
    "width": 800,
    "heigth": 600,
    "transformations": [
        ["1",  "0, .16*y"],
        ["7",  ".2*x -.26*y, .23*x + .22*y + 1.6"],
        ["7",  "-.15*x + .28*y, .26*x + .24*y + .44"],
        ["85", ".85*x + .04*y, -.04*x + .85*y + 1.6"]
    ]
}

The system is defined by the "transformations" list. It's a mapping of probability to the transformation function. Each number (first element of each transformation) is a proportional probability of that transformation to occur, and each function is an expression transforming a x and y arguments into another two-dimensional point (comma separated).

The sum of the probability keys are not necessary to sum to unity, as the probability is calculated proportionally (i. e. roulette wheel).

Examples

The Barnsley's Fern resembles remarkably the Black Spleenwort:

Barnsley's Fern

The Pentadentrite is a variation of the McWorter's pentigree:

Pentadentrite

A very beautiful spiral fractal:

Spiral

And, of course, the Sierpinksi triangle, which seems to pop up everywhere:

Sierpinksi

Try modifying or creating new formulas, it's fascinating to discover new patterns.

ifs's People

Contributors

rodrigosetti 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.