/iterated-function-systems

Iterated Function Systems fractals with OCaml.

Primary LanguageOCamlGNU General Public License v3.0GPL-3.0

Iterated Function Systems with OCaml

Fractals are images of infinite complexity, characterized by being "similar" to themselves in some sense at all scales of magnification.

Iterated function systems are a method of generating fractals using self-similarity. An IFS image is defined as being the sum of geometric transforms of itself. It turns out that simply specifying the transforms along with a weight for each transform is enough to determine the image.

How to use this code

In your shell

$ sudo apt install ocaml opam
$ opam init
$ opam install graphics
$ opam install ocamlfind
$ eval $(opam env)
$ ocaml
        OCaml version 4.11.1

# 

In your OCaml interpreter

# #use "ifs_fractals.ml";;
# draw barnsley 200000;;

Result

Barnsley Fern

Resources

This work was carried out during a functional programming course.

Some information about Iterated Function Systems (with the Barnsley Fern):

Alternatives