L-systems: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 219: | Line 219: | ||
<html> | <html> | ||
<form><textarea id="inputtext4" rows=3 cols=35 wrap="off" style="width:600px;"> | <form><textarea id="inputtext4" rows=3 cols=35 wrap="off" style="width:600px;"> | ||
var level = 4; | |||
var axiom = 'X'; | |||
var rules = { | |||
'F' : 'F', | |||
'X' : 'XFYFX+F+YFXFY-F-XFYFX', | |||
'Y' : 'YFXFY-F-XFYFX+F+YFXFY', | |||
'+' : '+', | |||
'-' : '-' | |||
}; | |||
var symbols = { 'F':'F', | |||
'X':' ', | |||
'Y':' ', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
} ; | |||
var angle = 90; | |||
var len = 300/Math.pow(3,level); | |||
</textarea><br /> | </textarea><br /> | ||
<input type="button" value="run" onClick="run(4)"> | <input type="button" value="run" onClick="run(4)"> | ||
Line 229: | Line 249: | ||
</script> | </script> | ||
</html> | </html> | ||
===Hexagonal Gosper curve=== | |||
<html> | |||
<form><textarea id="inputtext5" rows=3 cols=35 wrap="off" style="width:600px;"> | |||
var level = 5; | |||
var axiom = 'XF'; | |||
var rules = { | |||
'F' : 'F', | |||
'X' : 'X+YF++YF-FX--FXFX-YF+', | |||
'Y' : '-FX+YFYF++YF+FX--FX-Y', | |||
'+' : '+', | |||
'-' : '-' | |||
}; | |||
var symbols = { 'F':'F', | |||
'X':' ', | |||
'Y':' ', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
} ; | |||
var angle = 60; | |||
var len = 300/Math.pow(3,level); | |||
</textarea><br /> | |||
<input type="button" value="run" onClick="run(5)"> | |||
<input type="button" value="clear" onClick="clearturtle(5)"> | |||
</form> | |||
<div id="box5" class="jxgbox" style="width:600px; height:600px;"></div> | |||
<script language="JavaScript"> | |||
brd[5] = JXG.JSXGraph.initBoard('box5', {originX: 300, originY: 300, unitX: 1, unitY: 1}); | |||
turtle[5] = new JSXTurtleObj(brd[5]); | |||
</script> | |||
</html> | |||
===Plant 1=== | |||
<html> | |||
<form><textarea id="inputtext6" rows=3 cols=35 wrap="off" style="width:600px;"> | |||
var level = 4; | |||
var axiom = 'F'; | |||
var rules = { | |||
'F' : 'F[+F]F[-F]F', | |||
'[' : '[', | |||
']' : ']', | |||
'+' : '+', | |||
'-' : '-' | |||
}; | |||
var symbols = { 'F':'F', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
} ; | |||
var angle = 25.7; | |||
var len = 200/Math.pow(3,level); | |||
</textarea><br /> | |||
<input type="button" value="run" onClick="run(6)"> | |||
<input type="button" value="clear" onClick="clearturtle(6)"> | |||
</form> | |||
<div id="box6" class="jxgbox" style="width:600px; height:600px;"></div> | |||
<script language="JavaScript"> | |||
brd[6] = JXG.JSXGraph.initBoard('box6', {originX: 300, originY: 300, unitX: 1, unitY: 1}); | |||
turtle[6] = new JSXTurtleObj(brd[6]); | |||
</script> | |||
</html> | |||
===Plant 2=== | |||
<html> | |||
<form><textarea id="inputtext7" rows=3 cols=35 wrap="off" style="width:600px;"> | |||
var level = 4; | |||
var axiom = 'X'; | |||
var rules = { | |||
'F' : 'FF', | |||
'X' : 'F-[[X]+X]+F[+FX]-X', | |||
'[' : '[', | |||
']' : ']', | |||
'+' : '+', | |||
'-' : '-' | |||
}; | |||
var symbols = { 'F':'F', | |||
'X':' ', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
} ; | |||
var angle = 22.5; | |||
var len = 300/Math.pow(3,level); | |||
</textarea><br /> | |||
<input type="button" value="run" onClick="run(7)"> | |||
<input type="button" value="clear" onClick="clearturtle(7)"> | |||
</form> | |||
<div id="box7" class="jxgbox" style="width:600px; height:600px;"></div> | |||
<script language="JavaScript"> | |||
brd[7] = JXG.JSXGraph.initBoard('box7', {originX: 300, originY: 300, unitX: 1, unitY: 1}); | |||
turtle[7] = new JSXTurtleObj(brd[7]); | |||
</script> | |||
</html> | |||
===Hexagonal kolam=== | |||
<html> | |||
<form><textarea id="inputtext8" rows=3 cols=35 wrap="off" style="width:600px;"> | |||
var level = 12; | |||
var axiom = 'X'; | |||
var rules = { | |||
'F' : 'F', | |||
'X' : '[-F+F[Y]+F][+F-F[X]-F]', | |||
'Y' : '[-F+F[Y]+F][+F-F-F]', | |||
'[' : '[', | |||
']' : ']', | |||
'+' : '+', | |||
'-' : '-' | |||
}; | |||
var symbols = { 'F':'F', | |||
'X':' ', | |||
'Y':' ', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
} ; | |||
var angle = 60; | |||
var len = 100/(level); | |||
</textarea><br /> | |||
<input type="button" value="run" onClick="run(8)"> | |||
<input type="button" value="clear" onClick="clearturtle(8)"> | |||
</form> | |||
<div id="box8" class="jxgbox" style="width:600px; height:600px;"></div> | |||
<script language="JavaScript"> | |||
brd[8] = JXG.JSXGraph.initBoard('box8', {originX: 300, originY: 300, unitX: 1, unitY: 1}); | |||
turtle[8] = new JSXTurtleObj(brd[8]); | |||
</script> | |||
</html> | |||
===Mango kolam=== | |||
<html> | |||
<form><textarea id="inputtext9" rows=3 cols=35 wrap="off" style="width:600px;"> | |||
var level = 5; | |||
var axiom = 'A---A'; | |||
var rules = { | |||
'F' : 'F', | |||
'f' : 'f', | |||
'A' : 'f-F+Z+F-fA', | |||
'Z' : 'F-FF-F--[--Z]F-FF-F--F-FF-F--', | |||
'[' : '[', | |||
']' : ']', | |||
'+' : '+', | |||
'-' : '-' | |||
}; | |||
var symbols = { 'F':'F', | |||
'f':'f', | |||
'A':' ', | |||
'Z':' ', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
} ; | |||
var angle = 60; | |||
var len = 100/(level); | |||
</textarea><br /> | |||
<input type="button" value="run" onClick="run(9)"> | |||
<input type="button" value="clear" onClick="clearturtle(9)"> | |||
</form> | |||
<div id="box9" class="jxgbox" style="width:600px; height:600px;"></div> | |||
<script language="JavaScript"> | |||
brd[9] = JXG.JSXGraph.initBoard('box9', {originX: 300, originY: 300, unitX: 1, unitY: 1}); | |||
turtle[9] = new JSXTurtleObj(brd[9]); | |||
</script> | |||
</html> | |||
===Penrose tiling=== | |||
<html> | |||
<form><textarea id="inputtext10" rows=3 cols=35 wrap="off" style="width:600px;"> | |||
var level = 2; | |||
var Axiom = '[7]++[7]++[7]++[7]++[7]'; | |||
var rules = { | |||
'6' : '81++91----71[-81----61]++', | |||
'7' : '+81--91[---61--71]+', | |||
'8' : '-61++71[+++81++91]-', | |||
'9' : '--81++++61[+91++++71]--71', | |||
'1' : '', | |||
'+' : '+', | |||
'-' : '-', | |||
'[' : '[', | |||
']' : ']' | |||
}; | |||
var symbols = { | |||
'1':'F', | |||
'6':' ', | |||
'7':' ', | |||
'8':' ', | |||
'9':' ', | |||
'+':'+', | |||
'-':'-', | |||
'[':'[', | |||
']':']' | |||
}; | |||
var angle = 36.0; | |||
var len = 100/(level); | |||
</textarea><br /> | |||
<input type="button" value="run" onClick="run(10)"> | |||
<input type="button" value="clear" onClick="clearturtle(10)"> | |||
</form> | |||
<div id="box10" class="jxgbox" style="width:600px; height:600px;"></div> | |||
<script language="JavaScript"> | |||
brd[10] = JXG.JSXGraph.initBoard('box10', {originX: 300, originY: 300, unitX: 1, unitY: 1}); | |||
turtle[10] = new JSXTurtleObj(brd[10]); | |||
</script> | |||
</html> | |||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Turtle Graphics]] | [[Category:Turtle Graphics]] |
Revision as of 19:59, 30 December 2008
Sierpinski curve
Quadratic snowflake variation
Dragon curve
Islands and lakes
Peano curve
Hexagonal Gosper curve
Plant 1
Plant 2
Hexagonal kolam
Mango kolam
Penrose tiling