Update README for JSON inputs

This commit is contained in:
Dimitri Lozeve 2018-01-17 22:36:15 +00:00
parent 3f8d761d8e
commit 217ebcf8f6

View file

@ -15,17 +15,28 @@ This program can be used to generate arbitrary L-systems. It supports:
+ personalized angle and segment length for the representation
+ push ('[') and pop (']') operations
** ~LSystem~ data type
** L-systems
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.)
*** ~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.)
*** JSON format for L-systems
L-systems can be specified using a straightforward JSON encoding. See
the =examples/= folder for examples.
Note that the ~rules~ and ~representation~ keys are associated to
arrays of arrays in JSON. ~angle~ and ~distance~ are
numbers. Everything else should be a string.
** Building and running
@ -34,7 +45,7 @@ You will need [[https://docs.haskellstack.org/][Stack]].
From the repository, run:
#+BEGIN_SRC sh
stack build
stack exec lsystems-exe
stack exec lsystems-exe -- examples/penroseP3.json
#+END_SRC
This will open a window, where you can move around using the mouse and
@ -51,22 +62,22 @@ command-line arguments, see the output of ~--help~:
#+BEGIN_SRC
lsystems -- Generate L-systems
Usage: lsystems-exe [LSYSTEM] [-n|--iterations N] [-c|--color R,G,B]
[-w|--white-background] [-l|--list-lsystems]
Usage: lsystems-exe FILENAME [-n|--iterations N] [-c|--color R,G,B]
[-w|--white-background]
Generate and draw an L-system
Available options:
LSYSTEM L-system to generate (default: penroseP3)
FILENAME JSON file specifying an L-system
-n,--iterations N Number of iterations (default: 5)
-c,--color R,G,B Foreground color RGBA
(0-255) (default: RGBA 1.0 1.0 1.0 1.0)
-w,--white-background Use a white background
-l,--list-lsystems List all available L-systems
-h,--help Show this help text
#+END_SRC
** Examples
** Examples provided
Examples are provided in the =examples/= directory.
*** Space-filling curves