Update README for JSON inputs
This commit is contained in:
parent
3f8d761d8e
commit
217ebcf8f6
1 changed files with 27 additions and 16 deletions
25
README.org
25
README.org
|
@ -15,7 +15,9 @@ This program can be used to generate arbitrary L-systems. It supports:
|
||||||
+ personalized angle and segment length for the representation
|
+ personalized angle and segment length for the representation
|
||||||
+ push ('[') and pop (']') operations
|
+ push ('[') and pop (']') operations
|
||||||
|
|
||||||
** ~LSystem~ data type
|
** L-systems
|
||||||
|
|
||||||
|
*** ~LSystem~ data type
|
||||||
|
|
||||||
An L-system consists of:
|
An L-system consists of:
|
||||||
+ the L-system itself:
|
+ the L-system itself:
|
||||||
|
@ -27,6 +29,15 @@ An L-system consists of:
|
||||||
+ a set of representation rules (which symbols mean "draw forward",
|
+ a set of representation rules (which symbols mean "draw forward",
|
||||||
"turn left", "pop a position", etc.)
|
"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
|
** Building and running
|
||||||
|
|
||||||
You will need [[https://docs.haskellstack.org/][Stack]].
|
You will need [[https://docs.haskellstack.org/][Stack]].
|
||||||
|
@ -34,7 +45,7 @@ You will need [[https://docs.haskellstack.org/][Stack]].
|
||||||
From the repository, run:
|
From the repository, run:
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
stack build
|
stack build
|
||||||
stack exec lsystems-exe
|
stack exec lsystems-exe -- examples/penroseP3.json
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
This will open a window, where you can move around using the mouse and
|
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
|
#+BEGIN_SRC
|
||||||
lsystems -- Generate L-systems
|
lsystems -- Generate L-systems
|
||||||
|
|
||||||
Usage: lsystems-exe [LSYSTEM] [-n|--iterations N] [-c|--color R,G,B]
|
Usage: lsystems-exe FILENAME [-n|--iterations N] [-c|--color R,G,B]
|
||||||
[-w|--white-background] [-l|--list-lsystems]
|
[-w|--white-background]
|
||||||
Generate and draw an L-system
|
Generate and draw an L-system
|
||||||
|
|
||||||
Available options:
|
Available options:
|
||||||
LSYSTEM L-system to generate (default: penroseP3)
|
FILENAME JSON file specifying an L-system
|
||||||
-n,--iterations N Number of iterations (default: 5)
|
-n,--iterations N Number of iterations (default: 5)
|
||||||
-c,--color R,G,B Foreground color RGBA
|
-c,--color R,G,B Foreground color RGBA
|
||||||
(0-255) (default: RGBA 1.0 1.0 1.0 1.0)
|
(0-255) (default: RGBA 1.0 1.0 1.0 1.0)
|
||||||
-w,--white-background Use a white background
|
-w,--white-background Use a white background
|
||||||
-l,--list-lsystems List all available L-systems
|
|
||||||
-h,--help Show this help text
|
-h,--help Show this help text
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Examples
|
||||||
|
|
||||||
** Examples provided
|
Examples are provided in the =examples/= directory.
|
||||||
|
|
||||||
*** Space-filling curves
|
*** Space-filling curves
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue