|
|
|
@ -30,10 +30,10 @@ var r = generate('A'.split(''),
@@ -30,10 +30,10 @@ var r = generate('A'.split(''),
|
|
|
|
|
function dragon_curve(variant) { |
|
|
|
|
project.clear(); |
|
|
|
|
var r = generate( |
|
|
|
|
'FX'.split(''), |
|
|
|
|
'FX', |
|
|
|
|
[ |
|
|
|
|
['X'.split(''), 'X+YF+'.split('')], |
|
|
|
|
['Y'.split(''), '-FX-Y'.split('')] |
|
|
|
|
['X', 'X+YF+'], |
|
|
|
|
['Y', '-FX-Y'] |
|
|
|
|
], |
|
|
|
|
12 |
|
|
|
|
); |
|
|
|
@ -70,17 +70,20 @@ function sierpinski2(num_defects) {
@@ -70,17 +70,20 @@ function sierpinski2(num_defects) {
|
|
|
|
|
project.clear(); |
|
|
|
|
if(typeof num_defects == 'undefined') { num_defects = 0 }; |
|
|
|
|
var r = generate( |
|
|
|
|
'IA'.split(''), |
|
|
|
|
'IA', |
|
|
|
|
[ |
|
|
|
|
['A'.split(''), 'B-A-B'.split('')], |
|
|
|
|
['B'.split(''), 'A+B+A'.split('')] |
|
|
|
|
['A', 'B-A-B'], |
|
|
|
|
['B', 'A+B+A'] |
|
|
|
|
], |
|
|
|
|
8 |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
for(var i=0; i<num_defects; i++) { |
|
|
|
|
r[Math.floor(Math.random()*r.length)] = '*'; |
|
|
|
|
} |
|
|
|
|
if(num_defects > 0) { |
|
|
|
|
r = r.split(''); |
|
|
|
|
for(var i=0; i<num_defects; i++) { |
|
|
|
|
r[Math.floor(Math.random()*r.length)] = '*'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var actions = { |
|
|
|
|
'A': draw_forward(), |
|
|
|
@ -104,10 +107,10 @@ function sierpinski2(num_defects) {
@@ -104,10 +107,10 @@ function sierpinski2(num_defects) {
|
|
|
|
|
function sierpinski() { |
|
|
|
|
project.clear(); |
|
|
|
|
var r = generate( |
|
|
|
|
'IF-G-G'.split(''), |
|
|
|
|
'IF-G-G', |
|
|
|
|
[ |
|
|
|
|
['F'.split(''), 'F-G+F+G-F'.split('')], |
|
|
|
|
['G'.split(''), 'GG'.split('')] |
|
|
|
|
['F', 'F-G+F+G-F'], |
|
|
|
|
['G', 'GG'] |
|
|
|
|
], |
|
|
|
|
6 |
|
|
|
|
); |
|
|
|
@ -137,10 +140,10 @@ function sierpinski() {
@@ -137,10 +140,10 @@ function sierpinski() {
|
|
|
|
|
project.clear(); |
|
|
|
|
if(typeof num_defects == 'undefined') { num_defects = 0 }; |
|
|
|
|
var r = generate( |
|
|
|
|
'iIXF'.split(''), |
|
|
|
|
'iIXF', |
|
|
|
|
[ |
|
|
|
|
['X'.split(''), 'F+[[X]-X]-F[-FX]+X'.split('')], |
|
|
|
|
['F'.split(''), 'FF'.split('')] |
|
|
|
|
['X', 'F+[[X]-X]-F[-FX]+X'], |
|
|
|
|
['F', 'FF'] |
|
|
|
|
], |
|
|
|
|
6 |
|
|
|
|
); |
|
|
|
@ -190,9 +193,9 @@ function sierpinski() {
@@ -190,9 +193,9 @@ function sierpinski() {
|
|
|
|
|
project.clear(); |
|
|
|
|
if(typeof num_defects == 'undefined') { num_defects = 0 }; |
|
|
|
|
var r = generate( |
|
|
|
|
'iIjJX'.split(''), |
|
|
|
|
'iIjJX', |
|
|
|
|
[ |
|
|
|
|
['X'.split(''), 'F[-lfX][cfX][+rfX]'.split('')], |
|
|
|
|
['X', 'F[-lfX][cfX][+rfX]'], |
|
|
|
|
//['F'.split(''), 'FF'.split('')], |
|
|
|
|
//['L'.split(''), 'LL'.split('')], |
|
|
|
|
//['C'.split(''), 'CC'.split('')], |
|
|
|
|