diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-05-18 11:24:56 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-05-18 11:25:33 +0300 |
| commit | 2a406132971291979bcb0eb20d41828acd9ff42a (patch) | |
| tree | 9005b991789a1c70f0bfdcf4e4a2e4d88405647f /README.md | |
| parent | 96362954992abcc1686928a4075426079584905b (diff) | |
updated README with L-sys definition
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -3,6 +3,23 @@ L-Systems.JS A full, 3D L-Systems implementation in JavaScript +Usage +----- + +```js +var lsys = new LSystem('F', { 'F' : 'F-F+FF' }); +var tree = lsys.iterate(2); +console.log(tree); // F-F+FF-F-F+FF+F-F+FFF-F+FF +``` + +Definition +------ + +An L-system is a formal grammar defined as an initial axiom string, and a set +of production rules. In te aforementioned example, `F` is the initial axiom, +and only one production rule exists: `F -> F-F+FF`. The grammar alphabet is +assumed to be all characters with a production rule mapping. + Syntax ------ @@ -12,12 +29,3 @@ Syntax - `<` / `>`: roll right / left by angle `alpha` - `|`: reverse vector direction - `[` / `]`: push / pop current tree state - -Usage ------ - -```js -var lsys = new LSystem('F', { 'F' : 'F-F+FF' }); -var tree = lsys.iterate(2); -console.log(tree) // F-F+FF-F-F+FF+F-F+FFF-F+FF -``` |
