Browse Source

remove defects code from some other tree

master
Fr3deric 5 years ago
parent
commit
a8fe5c4a9a
  1. 18
      lindenmayer-system/lindenmeyer-system.html

18
lindenmayer-system/lindenmeyer-system.html

@ -189,7 +189,7 @@ function sierpinski() {
* some other tree * some other tree
************************************************/ ************************************************/
function other_tree(num_defects) { function other_tree() {
project.clear(); project.clear();
if(typeof num_defects == 'undefined') { num_defects = 0 }; if(typeof num_defects == 'undefined') { num_defects = 0 };
var r = generate( var r = generate(
@ -204,22 +204,6 @@ function sierpinski() {
8 8
); );
var n = 0;
while(n < num_defects) {
var rnd = Math.floor(Math.random()*r.length);
if((r[rnd] != '[') & (r[rnd] != ']')) {
r[rnd] = '*';
if(Math.random() > 0.9) {
if(Math.random() < 0.5) {
r.splice(rnd, 0, '+');
} else {
r.splice(rnd, 0, '-');
}
}
n += 1;
}
}
console.log(r); console.log(r);
var p = draw( var p = draw(
r, r,

Loading…
Cancel
Save