L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 126: Line 126:
* [[Quadratic snowflake variation]]
* [[Quadratic snowflake variation]]
* [[Dragon curve]]
* [[Dragon curve]]
 
* [[Islands and lakes]]
===Dragon curve===
 
<html>
<form><textarea id="inputtext2" rows=3 cols=35 wrap="off" style="width:600px;">
var level = 8;
var axiom = 'Fl';
var rules = {
    'F' : 'F',
    'l' : 'l+rF+',
    'r' : '-Fl-r',
    '+' : '+',
    '-' : '-'
};
var symbols = { 'F':'F',
                'l':' ',
                'r':' ',
                '+':'+',
                '-':'-',
                '[':'[',
                ']':']'
              } ;
             
var angle = 90;
var len = 500/(level*level);
</textarea><br />
<input type="button" value="run" onClick="run(2)">
<input type="button" value="clear" onClick="clearturtle(2)">
</form>
<div id="box2" class="jxgbox" style="width:600px; height:600px;"></div>
<script language="JavaScript">
brd[2] = JXG.JSXGraph.initBoard('box2', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[2] = brd[2].createElement('turtle');
</script>
</html>
 
===Islands and lakes===


<html>
<html>

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