L-systems: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<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}); | ||
t[0] = new JSXTurtleObj(brd[0]); | |||
function expander(level,axiom,rules) { | function expander(level,axiom,rules) { | ||
Line 63: | Line 62: | ||
} | } | ||
function plotter(generator,symbols,len,angle | function plotter(generator,symbols,len,angle) { | ||
for (var c; c=generator.next(); c) { | for (var c; c=generator.next(); c) { | ||
switch(symbols[c]) { | switch(symbols[c]) { | ||
Line 104: | Line 103: | ||
eval(code); | eval(code); | ||
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[nr].unsuspendUpdate(); | brd[nr].unsuspendUpdate(); | ||
} | } | ||
Line 111: | Line 110: | ||
turtle[nr].cs(); | turtle[nr].cs(); | ||
} | } | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 19:40, 30 December 2008