Difference between revisions of "L-systems"

From JSXGraph Wiki
Jump to navigationJump to search
Line 125: Line 125:
* [[Quadratic snowflake variation]]
* [[Quadratic snowflake variation]]
* [[Dragon curve]]
===Quadratic snowflake variation===
<form><textarea id="inputtext1" rows=3 cols=35 wrap="off" style="width:600px;">
var level = 5;
var axiom = '+F';
var rules = {
    '+' : '+',
    '-' : '-'
var symbols = { 'F':'F',
              } ;
var angle = 90;
var len = 500/Math.pow(3,level);
</textarea><br />
<input type="button" value="run" onClick="run(1)">
<input type="button" value="clear" onClick="clearturtle(1)">
<div id="box1" class="jxgbox" style="width:600px; height:600px;"></div>
<script language="JavaScript">
brd[1] = JXG.JSXGraph.initBoard('box1', {originX: 300, originY: 300, unitX: 1, unitY: 1});
turtle[1] = brd[1].createElement('turtle');
===Dragon curve===
===Dragon curve===

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

Dragon curve

Islands and lakes

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