Difference between revisions of "L-systems"

From JSXGraph Wiki
Jump to navigationJump to search
Line 150: Line 150:
 
<html>
 
<html>
 
<form><textarea id="inputtext2" rows=3 cols=35 wrap="off" style="width:600px;">
 
<form><textarea id="inputtext2" rows=3 cols=35 wrap="off" style="width:600px;">
 +
var level = 8;
 +
var axiom = 'Fl';
 +
var rules = {
 +
    'F' : 'F',
 +
    'l' : 'l+rF+',
 +
    'r' : '-Fl-r',
 +
    '+' : '+',
 +
    '-' : '-'
 +
};
 +
var symbols = { 'F':'F',
 +
                'l':' ',
 +
                'r':' ',
 +
                '+':'+',
 +
                '-':'-',
 +
                '[':'[',
 +
                ']':']'
 +
              } ;
 +
             
 +
var angle = 90;
 +
var len = 500/(level*level);
 
</textarea><br />
 
</textarea><br />
 
<input type="button" value="run" onClick="run(2)">
 
<input type="button" value="run" onClick="run(2)">
Line 160: Line 180:
 
</script>
 
</script>
 
</html>
 
</html>
 +
 +
===Islands and lakes===
 +
 +
<html>
 +
<form><textarea id="inputtext3" rows=3 cols=35 wrap="off" style="width:600px;">
 +
var level = 2;
 +
var axiom = 'F-F-F-F';
 +
var rules = {
 +
    'F' : 'F-f+FF-F-FF-Ff-FF+f-FF+F+FF+Ff+FFF',
 +
    'f' : 'ffffff',
 +
    '+' : '+',
 +
    '-' : '-'
 +
};
 +
var symbols = { 'F':'F',
 +
                'f':'f',
 +
                '+':'+',
 +
                '-':'-',
 +
                '[':'[',
 +
                ']':']'
 +
              } ;
 +
             
 +
var angle = 90;
 +
var len = 20/Math.pow(2,level);
 +
</textarea><br />
 +
<input type="button" value="run" onClick="run(3)">
 +
<input type="button" value="clear" onClick="clearturtle(3)">
 +
</form>
 +
<div id="box3" class="jxgbox" style="width:600px; height:600px;"></div>
 +
<script language="JavaScript">
 +
brd[3] = JXG.JSXGraph.initBoard('box3', {originX: 300, originY: 300, unitX: 1, unitY: 1});
 +
turtle[3] = new JSXTurtleObj(brd[3]);
 +
</script>
 +
</html>
 +
 +
 +
===Peano curve===
 +
 +
<html>
 +
<form><textarea id="inputtext4" rows=3 cols=35 wrap="off" style="width:600px;">
 +
</textarea><br />
 +
<input type="button" value="run" onClick="run(4)">
 +
<input type="button" value="clear" onClick="clearturtle(4)">
 +
</form>
 +
<div id="box4" class="jxgbox" style="width:600px; height:600px;"></div>
 +
<script language="JavaScript">
 +
brd[4] = JXG.JSXGraph.initBoard('box4', {originX: 300, originY: 300, unitX: 1, unitY: 1});
 +
turtle[4] = new JSXTurtleObj(brd[4]);
 +
</script>
 +
</html>
 +
  
 
[[Category:Examples]]
 
[[Category:Examples]]
 
[[Category:Turtle Graphics]]
 
[[Category:Turtle Graphics]]

Revision as of 20:56, 30 December 2008

Sierpinski curve



Quadratic snowflake variation


Dragon curve


Islands and lakes



Peano curve