Scripte: Lindenmayer Systeme.
Script mit Doppelklick oder STRG+R aufrufen
-------------------------------------------

===========================================
L-Systeme mit Parametern
--------------------------- ScriptBegin
var Grafik  = "Script Lindenmayer";
var Tiefe   = 6;
var Alpha   = 86;
var Schritt = 180;
var Axiom   = "F(1)";
var Regeln  = "F(0)";

var c = 1;
var p = c*0.3;
var q = c - p;
var h = Math.sqrt(p*q);

function F(x)
{ var s=""; 
  return s.concat( "F(", x*p, ")+F(",x*h,")--F(",x*h,")+F(",x*q,")"); 
}


function init()
{  t.setBrush("IndianRed"); 
   t.setPage();
   t.makeLSystem();
   t.msg(t.showLInfo());
}

function draw()
{ var x=-130; var y=-50;
  
  //t.drawKoordSystem();  
  t.setNoStyle();
  //t.turnTo(38)
  t.beginPolygon();
  t.goTo(x,y);
  t.drawLSystem(); 

  t.move(100,1); t.turnTo(-90); t.move(100,1); 
  t.moveTo(x-50,t.lastY()); t.moveTo(t.lastX(),y);
  t.endPolygon();
  
  t.goTo(0,0); t.turnTo(0);
  t.setPen("black",0.2);
  t.setBrush("OliveDrab");  //"ForestGreen" "DarkGreen"
  t.drawPolygon();
  t.rahmen();
}
ScriptEnd#1 -------------------------------


===========================================
L-Systeme mit Parametern
--------------------------- ScriptBegin
var Grafik  ="Script Lindenmayer";
var Tiefe   = 9;
var Alpha   = 88;
var Schritt = 330;
var Axiom   = "F(1,0)";
var Regeln  = "F(1,1)";

var c = 1;
var p = c*0.35;
var q = c - p;
var h = -Math.sqrt(p*q);

function F(x,t)
{var s=""; 

 if (t==0)
  { return s.concat( "F(", x*p, ",2)+F(", x*h, ",1)--F(", x*h, ",1)+F(", x*q, ",0)");
  }
 else return s.concat( "F(",x,",",t-1,")");
}


function init()
{ t.setBrush("PaleTurquoise");  //"Aquamarine"
  t.setPage();
  t.makeLSystem(); 
  t.msg(t.showLInfo());
}


function draw()
{ var x=-135; var y=55;

  //t.drawKoordSystem(10,true);  
  t.setNoStyle();
  t.turnTo(0)
  t.beginPolygon();
  t.goTo(x,y);
  t.drawLSystem(); 

  t.move(100); t.turnTo(-90); t.move(200); 
  t.moveTo(x-50,t.lastY()); t.moveTo(t.lastX(),y); 
  t.endPolygon();
  
  t.goTo(0,0); t.turnTo(0); 
  t.setPen("MidnightBlue ",0.2);
  t.setBrush("Khaki") //"Orange" "Gold"
  t.drawPolygon();
  t.rahmen();
}
ScriptEnd#2 -------------------------------


===========================================
L-Systeme mit Parametern
--------------------------- ScriptBegin
var Grafik  = "Script Lindenmayer";
var Tiefe   = 15;
var Alpha   = 73;
var Schritt = 1;
//var Axiom   = "W(2.0)FW(1.0)+F";
var Axiom   = "A(90)";
var Regeln  = "A(1) W(1)";

//var r = 1.556;
var r = 1.55;

function A(x)
{var s=""; 
 return s.concat( "W(0.1)F(", x, ")[+A(", x/r, ")][-A(", x/r, ")]");
}

function W(x)
{var s=""; 
 return s.concat( "W(",x*1.45,")");
}


function init()
{ t.setBrush("Moccasin"); 
  t.setPage();
  t.setAutoPaint(false);
  t.makeLSystem(); 
  t.msg(t.showLInfo()); 
}

function draw()
{ var x0=0; var y0=-95;   
  //t.drawKoordSystem(10,true); 
  

  t.setNoStyle();
  t.turnTo(90); 
  t.moveTo(x0,y0);
  t.setPen("#8e5c4e");
  t.setPenWidth(0.01,0);  
  t.drawLSystem();  
  t.endPolygon();

  t.setPenWidth(4); 
  t.goTo(x0-150,y0); t.turnTo(0); t.move(300); 

}
ScriptEnd#3 -------------------------------
