L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
Line 14: Line 14:
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxturtle.js"></script>
<form><textarea id="inputtext0" rows=3 cols=35 wrap="off" style="width:600px;">
<form><textarea id="inputtext0" rows=3 cols=35 wrap="off" style="width:600px;">
var level = 6;
var level = 6;
Line 45: Line 44:
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]);
turtle[0] = brd[0].createElement('turtle');


function expander(level,axiom,rules) {
function expander(level,axiom,rules) {
Line 153: Line 152:
<script language="JavaScript">
<script language="JavaScript">
brd[1] = JXG.JSXGraph.initBoard('box1', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[1] = JXG.JSXGraph.initBoard('box1', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[1] = new JSXTurtleObj(brd[1]);
turtle[1] = brd[1].createElement('turtle');
</script>
</script>
</html>
</html>
Line 188: Line 187:
<script language="JavaScript">
<script language="JavaScript">
brd[2] = JXG.JSXGraph.initBoard('box2', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[2] = JXG.JSXGraph.initBoard('box2', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[2] = new JSXTurtleObj(brd[2]);
turtle[2] = brd[2].createElement('turtle');
</script>
</script>
</html>
</html>
Line 221: Line 220:
<script language="JavaScript">
<script language="JavaScript">
brd[3] = JXG.JSXGraph.initBoard('box3', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[3] = JXG.JSXGraph.initBoard('box3', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[3] = new JSXTurtleObj(brd[3]);
turtle[3] = brd[3].createElement('turtle');
</script>
</script>
</html>
</html>
Line 258: Line 257:
<script language="JavaScript">
<script language="JavaScript">
brd[4] = JXG.JSXGraph.initBoard('box4', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[4] = JXG.JSXGraph.initBoard('box4', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[4] = new JSXTurtleObj(brd[4]);
turtle[4] = brd[4].createElement('turtle');
</script>
</script>
</html>
</html>
Line 294: Line 293:
<script language="JavaScript">
<script language="JavaScript">
brd[5] = JXG.JSXGraph.initBoard('box5', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[5] = JXG.JSXGraph.initBoard('box5', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[5] = new JSXTurtleObj(brd[5]);
turtle[5] = brd[5].createElement('turtle');
</script>
</script>
</html>
</html>
Line 330: Line 329:
<script language="JavaScript">
<script language="JavaScript">
brd[6] = JXG.JSXGraph.initBoard('box6', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[6] = JXG.JSXGraph.initBoard('box6', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[6] = new JSXTurtleObj(brd[6]);
turtle[6] = brd[6].createElement('turtle');
</script>
</script>
</html>
</html>
Line 367: Line 366:
<script language="JavaScript">
<script language="JavaScript">
brd[7] = JXG.JSXGraph.initBoard('box7', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[7] = JXG.JSXGraph.initBoard('box7', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[7] = new JSXTurtleObj(brd[7]);
turtle[7] = brd[7].createElement('turtle');
</script>
</script>
</html>
</html>
Line 405: Line 404:
<script language="JavaScript">
<script language="JavaScript">
brd[8] = JXG.JSXGraph.initBoard('box8', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[8] = JXG.JSXGraph.initBoard('box8', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[8] = new JSXTurtleObj(brd[8]);
turtle[8] = brd[8].createElement('turtle');
</script>
</script>
</html>
</html>
Line 444: Line 443:
<script language="JavaScript">
<script language="JavaScript">
brd[9] = JXG.JSXGraph.initBoard('box9', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[9] = JXG.JSXGraph.initBoard('box9', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[9] = new JSXTurtleObj(brd[9]);
turtle[9] = brd[9].createElement('turtle');
</script>
</script>
</html>
</html>
Line 487: Line 486:
<script language="JavaScript">
<script language="JavaScript">
brd[10] = JXG.JSXGraph.initBoard('box10', {originX: 300, originY: 300, unitX: 1, unitY: 1});
brd[10] = JXG.JSXGraph.initBoard('box10', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[10] = new JSXTurtleObj(brd[10]);
turtle[10] = brd[10].createElement('turtle');
</script>
</script>
</html>
</html>

Revision as of 15:12, 21 January 2009

Online experiments with Lindenmayer Systems

A Lindenmayer System consists of

  • an initial string called axiom
  • a set of rewriting rules

This is an experimental page, where the Lindenmayer Systems can be changed online. The visualization is done by the JavaScript library JSXGraph. For each system a maximum level is defined. If this value is increased, the complexity of the drawing rises and running time increases, too.

Most of the examples are from the book by Przemyslaw Prusinkiewicz and James Hanan: Lindenmayer Systems, Fractals, and Plants, see the References.

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


The underlying JavaScript code

The underlying JavaScript code for producing Lindenmayer systems

References