ScriptBegin
var Grafik="Script Escher";

var a=1.8;
    r=25;
    PenC ="black";    
    Fill ="black";
    Fill1 ="orange";
    Fill2 ="black";

    x0=0;
    y0=0;
    maxi = 40;
    maxj = 40;
    
    epsilon=0.00001;
    
function init() //Initialisierungen
{ t.setBrush(Fill2);
  t.setPage();
  t.setAntiAliasing();
} 

function draw() //Zeichenbefehle
{ //t.drawKoordSystem();
  //t.drawRaster();

  
  defBasis();
  t.goTo(0,0); t.turnTo(30); 
 // t.draw("Quadrat1");
 // t.morphDraw("Quadrat1");
  //t.setRotate(60);

  for(i=-maxi; i<=maxi; i++)
  { 
    for(j=-maxj; j<=maxj; j++)
    { x=i*a; y=j*a;
      
      d=(x-x0)*(x-x0)+(y-y0)*(y-y0);
      if (d>epsilon)
      {
        t.goTo(x,y); 
      n=(i*i+j*j)%2;
      t.morphDraw("Quadrat"+n);     
      }
    }
  }
}


function defBasis()
{ t.setNoStyle();
  t.goTo(-a/2,-a/2)
  t.rectPolygon(a,a)
  t.setPen(PenC); t.setBrush(Fill); 
  t.defDraw("Quadrat0");
  t.refineDraw("Quadrat0");
  t.setBrush(Fill1); 
  t.defDraw("Quadrat1");
  t.refineDraw("Quadrat1");
  t.setIdentity();
}


function morphX(x,y)
{//return 2*x+y 
 d=(x-x0)*(x-x0)+(y-y0)*(y-y0);
 return x0+r*r*(x-x0)/d;

}

function morphY(x,y)
{//return 2*y+x
 d=(x-x0)*(x-x0)+(y-y0)*(y-y0);
 return  y0+r*r*(y-y0)/d;
}


ScriptEnd

===============================================

ScriptBegin
var Grafik="Script Funktionen";

function f(x)
{ return x;
}

var u=0.00011;
function g(x)
{return x*x*x*u;  
}




function h(x)
{if (x<0) return Math.sqrt(-x*u);  
 return Math.sqrt(x*u);  
}

function init() //Initialisierungen
{ t.setPage(2); } 

function draw() //Zeichenbefehle
{ t.drawKoordSystem();
  t.drawRaster();
  t.drawGraf("g");
  t.setPen("red");
  t.drawGraf("f");
}
ScriptEnd



===================
ScriptBegin
var Grafik = "Script Funktionen";
var min = 0;
var max = 2*Math.PI;
var dt  = 0.05;

var a =  40; 
    b =  0.5
function init()
{ t.setAntiAliasing();
}

function fx(t){ return a * Math.cos(t)*(b+Math.cos(t));}
function fy(t){ return a * Math.sin(t)*(b+Math.cos(t));}


function draw()
{ t.drawKoordSystem();
  t.drawRaster();  
  t.setPen("red",0.4);
  t.drawGraf("fx","fy");

  t.turnTo(30);
  t.drawGraf("fx","fy");
}
ScriptEnd