Difference between revisions of "L-systems"

From JSXGraph Wiki
Jump to navigationJump to search
Line 134: Line 134:
 
* [[Mango kolam]]
 
* [[Mango kolam]]
 
* [[Penrose tiling]]
 
* [[Penrose tiling]]
 
<html>
 
<form><textarea id="inputtext10" rows=3 cols=35 wrap="off" style="width:600px;">
 
var level = 2;
 
var axiom = '[7]++[7]++[7]++[7]++[7]';
 
var rules = {
 
    '6' : '81++91----71[-81----61]++',
 
    '7' : '+81--91[---61--71]+',
 
    '8' : '-61++71[+++81++91]-',
 
    '9' : '--81++++61[+91++++71]--71',
 
    '1' : '',
 
    '+' : '+',
 
    '-' : '-',
 
    '[' : '[',
 
    ']' : ']'
 
  };
 
var symbols = {
 
                '1':'F',
 
                '6':' ',
 
                '7':' ',
 
                '8':' ',
 
                '9':' ',
 
                '+':'+',
 
                '-':'-',
 
                '[':'[',
 
                ']':']'
 
              };
 
var angle = 36.0;
 
var len = 100/(level);
 
t.setProperty({fillcolor:'#abff00'});
 
</textarea><br />
 
<input type="button" value="run" onClick="run(10)">
 
<input type="button" value="clear" onClick="clearturtle(10)">
 
</form>
 
<div id="box10" class="jxgbox" style="width:600px; height:600px;"></div>
 
<script language="JavaScript">
 
brd[10] = JXG.JSXGraph.initBoard('box10', {originX: 300, originY: 300, unitX: 1, unitY: 1});
 
turtle[10] = brd[10].createElement('turtle');
 
</script>
 
</html>
 
  
 
===The underlying JavaScript code===
 
===The underlying JavaScript code===
Line 182: Line 142:
 
* [http://en.wikipedia.org/wiki/L-system http://en.wikipedia.org/wiki/L-system]
 
* [http://en.wikipedia.org/wiki/L-system http://en.wikipedia.org/wiki/L-system]
 
* [http://en.wikipedia.org/wiki/Space-filling_curve http://en.wikipedia.org/wiki/Space-filling_curve]
 
* [http://en.wikipedia.org/wiki/Space-filling_curve http://en.wikipedia.org/wiki/Space-filling_curve]
* [http://en.wikipedia.org/wiki/Penrose_tiling http://en.wikipedia.org/wiki/Penrose_tiling]
 
* [http://en.wikipedia.org/wiki/Kolam http://en.wikipedia.org/wiki/Kolam]
 
  
  

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


The underlying JavaScript code

The underlying JavaScript code for producing Lindenmayer systems

References