From 217ebcf8f6f910fd12f0d67c20a2ed44a500ebaa Mon Sep 17 00:00:00 2001 From: Dimitri Lozeve Date: Wed, 17 Jan 2018 22:36:15 +0000 Subject: [PATCH] Update README for JSON inputs --- README.org | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/README.org b/README.org index 6275992..dc377a7 100644 --- a/README.org +++ b/README.org @@ -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