diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-05-18 11:32:26 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-05-18 11:32:26 +0300 |
| commit | a4db1bb5c3213fa4ef5645605b89429787f1b8f3 (patch) | |
| tree | 0d491cda7e3c2d1a136aadb6c773867ac3b8752c | |
| parent | 2a406132971291979bcb0eb20d41828acd9ff42a (diff) | |
updated README with draw() usage
| -rw-r--r-- | README.md | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,7 +1,8 @@ L-Systems.JS ============ -A full, 3D L-Systems implementation in JavaScript +A full, 3D L-Systems implementation in JavaScript. Generates trees by +production rules and draws by converting to cartesian coordinates. Usage ----- @@ -10,6 +11,8 @@ Usage 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 +var coords = lsys.draw(Math.PI / 2); // draw tree with alpha as 90 degrees +console.log(coords); // [[0,0,0], [0,1,0], [1,1,0], ... ``` Definition @@ -23,9 +26,9 @@ assumed to be all characters with a production rule mapping. Syntax ------ - - `F`: move one unit vector forward - - `+` / `-`: turn right / left by angle `alpha` - - `&` / `^`: pitch up / down by angle `alpha` - - `<` / `>`: roll right / left by angle `alpha` + - `F`: draw and move one unit vector forward + - `+`/`-`: turn right / left + - `&`/`^`: pitch up / down + - `<`/`>`: roll right / left - `|`: reverse vector direction - - `[` / `]`: push / pop current tree state + - `[`/`]`: push / pop current tree state |
