L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 132: Line 132:
* [[Plant generation II]]
* [[Plant generation II]]
* [[Hexagonal kolam]]
* [[Hexagonal kolam]]
 
* [[Mango kolam]]
<html>
<form><textarea id="inputtext8" rows=3 cols=35 wrap="off" style="width:600px;">
var level = 4;
var axiom = 'X';
var rules = {
    'F' : 'F',
    'X' : '[-F+F[Y]+F][+F-F[X]-F]',
    'Y' : '[-F+F[Y]+F][+F-F-F]',
    '[' : '[',
    ']' : ']',
    '+' : '+',
    '-' : '-'
};
var symbols = { 'F':'F',
                'X':' ',
                'Y':' ',
                '+':'+',
                '-':'-',
                '[':'[',
                ']':']'
              } ;
             
var angle = 60;
var len = 300/(level);
t.setPos(0,-250);
</textarea><br />
<input type="button" value="run" onClick="run(8)">
<input type="button" value="clear" onClick="clearturtle(8)">
</form>
<div id="box8" class="jxgbox" style="width:600px; height:600px;"></div>
<script language="JavaScript">
brd[8] = JXG.JSXGraph.initBoard('box8', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[8] = brd[8].createElement('turtle');
</script>
</html>
 
===Mango kolam===


<html>
<html>

Revision as of 17:18, 2 February 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




Penrose tiling


The underlying JavaScript code

The underlying JavaScript code for producing Lindenmayer systems

References