L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
===Sierpinski curve===
<html>
<html>
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
Line 35: Line 34:
var brd = [];
var brd = [];
brd[0] = JXG.JSXGraph.initBoard('box0', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[0] = JXG.JSXGraph.initBoard('box0', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[0] = new JSXTurtleObj(brd[0]);
t[0] = new JSXTurtleObj(brd[0]);


function expander(level,axiom,rules) {
function expander(level,axiom,rules) {
Line 100: Line 99:
   if (code=='') { return; }
   if (code=='') { return; }
   t = turtle[nr];
   t = turtle[nr];
  t.cs();
/* 
t.cs();
   t.hideTurtle();
   t.hideTurtle();
   eval(code);
   eval(code);
   var generator = new expander(level,axiom,rules);
   var generator = new expander(level,axiom,rules);
   plotter(generator,symbols,len,angle,t);
   plotter(generator,symbols,len,angle,t);
*/
   brd[nr].unsuspendUpdate();
   brd[nr].unsuspendUpdate();
}
}
Line 113: Line 114:
</script>
</script>
</html>
</html>
===Quadratic snowflake variation===
<html>
<form><textarea id="inputtext1" rows=3 cols=35 wrap="off" style="width:600px;">
</textarea><br />
<input type="button" value="run" onClick="run(1)">
<input type="button" value="clear" onClick="clearturtle(1)">
</form>
<div id="box1" class="jxgbox" style="width:600px; height:600px;"></div>
<script language="JavaScript">
brd[1] = JXG.JSXGraph.initBoard('box1', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[1] = new JSXTurtleObj(brd[1]);
</script>
</html>
===Dragon curve===


[[Category:Examples]]
[[Category:Examples]]
[[Category:Turtle Graphics]]
[[Category:Turtle Graphics]]

Revision as of 19:42, 30 December 2008