diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-05-21 13:42:37 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-05-21 13:42:37 +0300 |
| commit | 029f1aa1d0b18f761268c823971053af68064f8c (patch) | |
| tree | bce7829d62ca7d4c091437f56112bb5770e507bf | |
| parent | a6ee1cd24deed4d69fb092259812d8daa2ace716 (diff) | |
| parent | 007b3be9d09121d9fe0ffb7303bf5438e821fb61 (diff) | |
Merge branch 'master' into gh-pages
Conflicts:
index.html
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | lsys.js | 6 |
2 files changed, 7 insertions, 3 deletions
@@ -8,8 +8,8 @@ Usage ----- ```js -var lsys = new LSystem('F', { 'F' : 'F-F+FF' }); -var tree = lsys.iterate(2); +var lsys = new LSystem('F', { 'F' : 'F-F+FF' }).iterate(2); +var tree = lsys.print(); 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], ... @@ -9,6 +9,10 @@ function LSystem(axiom, rules) { return rules[c] || c; }); } + return this; + }; + + this.print = function() { return this.tree; }; @@ -125,7 +129,7 @@ function LSystem(axiom, rules) { this.reset = function() { this.tree = axiom; - return this.tree; + return this; }; this.debug = function() { |
