Skip to content

cedricbonhomme/iterated-function-systems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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