L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 130: Line 130:
* [[Hexagonal Gosper curve]]
* [[Hexagonal Gosper curve]]
* [[Plant generation I]]
* [[Plant generation I]]
===Plant 1===
* [[Plant generation II]]
 
<html>
<form><textarea id="inputtext6" rows=3 cols=35 wrap="off" style="width:600px;">
var level = 3;
var axiom = 'F';
var rules = {
    'F' : 'F[+F]F[-F]F',
    '[' : '[',
    ']' : ']',
    '+' : '+',
    '-' : '-'
};
var symbols = { 'F':'F',
                '+':'+',
                '-':'-',
                '[':'[',
                ']':']'
              } ;
             
var angle = 25.7;
var len = 500/Math.pow(3,level);
t.setPos(0,-250);
var shrink = 1.0;
t.setProperty({strokeColor:'green',strokeWidth:2});
</textarea><br />
<input type="button" value="run" onClick="run(6)">
<input type="button" value="clear" onClick="clearturtle(6)">
</form>
<div id="box6" class="jxgbox" style="width:600px; height:600px;"></div>
<script language="JavaScript">
brd[6] = JXG.JSXGraph.initBoard('box6', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[6] = brd[6].createElement('turtle');
</script>
</html>


===Plant 2===
===Plant 2===

Revision as of 17:15, 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


Plant 2


Hexagonal kolam


Mango kolam



Penrose tiling


The underlying JavaScript code

The underlying JavaScript code for producing Lindenmayer systems

References