Difference between revisions of "L-systems"

From JSXGraph Wiki
Jump to navigationJump to search
Line 131: Line 131:
 
* [[Plant generation I]]
 
* [[Plant generation I]]
 
* [[Plant generation II]]
 
* [[Plant generation II]]
 
+
* [[Hexagonal kolam]]
===Plant 2===
 
 
 
<html>
 
<form><textarea id="inputtext7" rows=3 cols=35 wrap="off" style="width:600px;">
 
var level = 4;
 
var axiom = 'X';
 
var rules = {
 
    'F' : 'FF',
 
    'X' : 'F-[[X]+X]+F[+FX]-X',
 
    '[' : '[',
 
    ']' : ']',
 
    '+' : '+',
 
    '-' : '-'
 
};
 
var symbols = { 'F':'F',
 
                'X':' ',
 
                '+':'+',
 
                '-':'-',
 
                '[':'[',
 
                ']':']'
 
              } ;
 
             
 
var angle = 22.5;
 
var len = 800/Math.pow(3,level);
 
t.setPos(0,-250);
 
t.setProperty({strokeColor:'green',strokeWidth:2});
 
</textarea><br />
 
<input type="button" value="run" onClick="run(7)">
 
<input type="button" value="clear" onClick="clearturtle(7)">
 
</form>
 
<div id="box7" class="jxgbox" style="width:600px; height:600px;"></div>
 
<script language="JavaScript">
 
brd[7] = JXG.JSXGraph.initBoard('box7', {originX: 300, originY: 300, unitX: 1, unitY: 1});
 
turtle[7] = brd[7].createElement('turtle');
 
</script>
 
</html>
 
 
 
===Hexagonal kolam===
 
  
 
<html>
 
<html>

Revision as of 18:16, 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



Mango kolam



Penrose tiling


The underlying JavaScript code

The underlying JavaScript code for producing Lindenmayer systems

References