L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 30: Line 30:
<div id="box0" class="jxgbox" style="width:600px; height:600px;"></div>
<div id="box0" class="jxgbox" style="width:600px; height:600px;"></div>
<script language="JavaScript">
<script language="JavaScript">
var brd0 = JXG.JSXGraph.initBoard('box0', {originX: 300, originY: 300, unitX: 1, unitY: 1});
var t;
var t;
var turtle = [];
var turtle = [];
var brd = [];
brd[0] = JXG.JSXGraph.initBoard('box0', {originX: 300, originY: 300, unitX: 1, unitY: 1});
t[0] = new JSXTurtleObj(brd0);
t[0] = new JSXTurtleObj(brd0);


Line 94: Line 95:


function run(nr) {
function run(nr) {
   brd.suspendUpdate();
   brd[nr].suspendUpdate();
   var code = $('inputtext'+nr).value;
   var code = $('inputtext'+nr).value;
   if (code=='') { return; }
   if (code=='') { return; }
Line 103: Line 104:
   var generator = new expander(level,axiom,rules);
   var generator = new expander(level,axiom,rules);
   plotter(generator,symbols,len,angle);
   plotter(generator,symbols,len,angle);
   brd.unsuspendUpdate();
   brd[nr].unsuspendUpdate();
}
}



Revision as of 19:40, 30 December 2008