summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2012-05-21 15:31:31 +0300
committerYuval Adam <yuv.adm@gmail.com>2012-05-21 15:31:31 +0300
commit037388ba3676dcd8ea9029063a59903155499011 (patch)
tree4010de42c56694f5e12636bb2fd6e69dfcaf882c
parent0b9f8b1ee2c5a7bbfda09472d7a225fbc95f7194 (diff)
parentbe02868d750d1924b53571fb338998e29c8c1418 (diff)
Merge branch 'master' into gh-pages
-rw-r--r--lsys.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lsys.js b/lsys.js
index ffa4479..9a027e7 100644
--- a/lsys.js
+++ b/lsys.js
@@ -1,7 +1,8 @@
-function LSystem(axiom, rules) {
+function LSystem(axiom, rules, draw_constants) {
this.axiom = axiom;
this.rules = rules;
this.tree = axiom;
+ this.draw_constants = draw_constants || [];
this.iterate = function(n) {
for (var i=0; i<n; i++) {
@@ -32,6 +33,10 @@ function LSystem(axiom, rules) {
for (var i=0; i<this.tree.length; i++) {
var c = this.tree.charAt(i);
+
+ if (this.draw_constants.indexOf(c) != -1) {
+ c = 'F';
+ }
switch(c) {
case '+':
U += alpha;