diff --git a/README.org b/README.org index d17135f..00da970 100644 --- a/README.org +++ b/README.org @@ -3,3 +3,68 @@ [[https://travis-ci.org/dlozeve/lsystems][https://travis-ci.org/dlozeve/lsystems.svg?branch=master]] [[https://opensource.org/licenses/BSD-3-Clause][https://img.shields.io/badge/License-BSD%203--Clause-blue.svg]] +Generate and draw [[https://en.wikipedia.org/wiki/L-system][L-systems]]! + +[[./img/demo.png]] + +** Introduction + +This program can be used to generate arbitrary L-systems. It supports: ++ full rewriting rules ++ full representation rules ++ personalized angle and segment length for the representation ++ push ('[') and pop (']') operations + +** ~LSystem~ data type + +An L-system consists of: ++ the L-system itself: + + an alphabet + + an axiom (i.e. the starting point) + + a set of rewriting rules (represented as a list of tuples) ++ rules to transform it into a graphical representation: + + an angle and a length + + a set of representation rules (which symbols mean "draw forward", + "turn left", "pop a position", etc.) + +** Building and running + +You will need [[https://docs.haskellstack.org/][Stack]]. + +From the repository, run: +#+BEGIN_SRC sh +stack build +stack exec lsystems-exe +#+END_SRC + +This will open a window, where you can move around using the mouse and +zoom by scrolling. + +For tests and documentation, run: +#+BEGIN_SRC sh +stack test --haddock +#+END_SRC + +** Examples provided + +*** Space-filling curves + ++ [[https://en.wikipedia.org/wiki/Hilbert_curve][Hilbert curve]] ++ [[https://en.wikipedia.org/wiki/Gosper_curve][Gosper curve]] + +*** Fractals + ++ [[https://en.wikipedia.org/wiki/L%C3%A9vy_C_curve][Lévy C curve]] ++ [[https://en.wikipedia.org/wiki/Koch_snowflake][Koch snowflake]] and Koch curve ++ [[https://en.wikipedia.org/wiki/Sierpinski_triangle][Sierpinski triangle]] and Sierpinski arrow curve ++ [[https://en.wikipedia.org/wiki/Dragon_curve][Dragon curve]] ++ Binary tree and fractal plant + +*** Tilings + ++ [[https://en.wikipedia.org/wiki/Penrose_tiling#Rhombus_tiling_(P3)][Penrose P3 tiling]] + +** Implementation + +The program is implemented in Haskell, using [[https://hackage.haskell.org/package/gloss][Gloss]] to display the +generated L-systems. diff --git a/img/demo.png b/img/demo.png new file mode 100644 index 0000000..6b090ba Binary files /dev/null and b/img/demo.png differ diff --git a/img/dragon.png b/img/dragon.png new file mode 100644 index 0000000..787aaea Binary files /dev/null and b/img/dragon.png differ diff --git a/img/gosper.png b/img/gosper.png new file mode 100644 index 0000000..3a6d568 Binary files /dev/null and b/img/gosper.png differ diff --git a/img/levyC.png b/img/levyC.png new file mode 100644 index 0000000..2428c22 Binary files /dev/null and b/img/levyC.png differ diff --git a/img/penroseP3.png b/img/penroseP3.png new file mode 100644 index 0000000..7c97e3f Binary files /dev/null and b/img/penroseP3.png differ diff --git a/img/plant.png b/img/plant.png new file mode 100644 index 0000000..4310e3f Binary files /dev/null and b/img/plant.png differ diff --git a/img/sierpinskiArrow.png b/img/sierpinskiArrow.png new file mode 100644 index 0000000..ae6dc3d Binary files /dev/null and b/img/sierpinskiArrow.png differ diff --git a/src/Examples.hs b/src/Examples.hs index 0b7c3ea..44be2cb 100644 --- a/src/Examples.hs +++ b/src/Examples.hs @@ -2,8 +2,8 @@ module Examples ( -- * Space-filling curves gosper , hilbert - , levyC -- * Fractals + , levyC , koch , kochSnowflake , sierpinski