Difference between revisions of "L-systems"

From JSXGraph Wiki
Jump to navigationJump to search
Line 127: Line 127:
 
* [[Dragon curve]]
 
* [[Dragon curve]]
 
* [[Islands and lakes]]
 
* [[Islands and lakes]]
 
+
* [[Peano curve]]
<html>
 
<form><textarea id="inputtext3" rows=3 cols=35 wrap="off" style="width:600px;">
 
var level = 2;
 
var axiom = 'F-F-F-F';
 
var rules = {
 
    'F' : 'F-f+FF-F-FF-Ff-FF+f-FF+F+FF+Ff+FFF',
 
    'f' : 'ffffff',
 
    '+' : '+',
 
    '-' : '-'
 
};
 
var symbols = { 'F':'F',
 
                'f':'f',
 
                '+':'+',
 
                '-':'-',
 
                '[':'[',
 
                ']':']'
 
              } ;
 
             
 
var angle = 90;
 
var len = 20/Math.pow(2,level);
 
</textarea><br />
 
<input type="button" value="run" onClick="run(3)">
 
<input type="button" value="clear" onClick="clearturtle(3)">
 
</form>
 
<div id="box3" class="jxgbox" style="width:600px; height:600px;"></div>
 
<script language="JavaScript">
 
brd[3] = JXG.JSXGraph.initBoard('box3', {originX: 300, originY: 300, unitX: 1, unitY: 1});
 
turtle[3] = brd[3].createElement('turtle');
 
</script>
 
</html>
 
 
 
 
 
 
===Peano curve===
 
===Peano curve===
  

Revision as of 19:11, 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


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