Verschiedene Spiralen mit "Script Funktionen"

Es werden zwei Paramterfunktionen fx(u)
und fy(u) mit drawGraf("fx","fy") verwendet.


Script mit Doppelklick oder STRG+R aufrufen!
____________________________________________


Logarithmische Spirale
======================
ScriptBegin
var Grafik = "Script Funktionen";

var min = 40;   // t Minimum
var max = 250;  // t Maximum
var dt  = 0.05; // dt Schritt

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

var a = 0.8; var b = 0.02;

function init()
{ t.setBrush("black");
  t.setPage();
  t.setAntiAliasing();
}

function draw()
{ t.setPen("lightblue", 0.2);
  t.drawGraf("fx","fy");

  min= -140; max= 140; dt= 0.2; a=2; b=0.03;
  t.setPen("red", 0.4);
  t.drawGraf("fy");
}
ScriptEnd#LogExp
____________________________________________



Archimedische Spirale
=====================
ScriptBegin
var Grafik = "Script Funktionen";

var min = -4.9*Math.PI;
var max = 0;
var dt  = 0.001;

var a = 0.50; 
    b = a;


function init()
{ t.setGradient(-200,-70,200,70,"blue","blue");
  t.setGradient(0.5,"red");
  t.setBrush("",15);
  t.setPage();  
  t.setAntiAliasing();
  t.setAutoPaint(false);
  min0=min; max0=max; a0=a; b0=b;
}

var min0,max0,a0,b0;

function ax(u){ return a * u*u* Math.cos(u*u); }
function ay(u){ return b * u*u * Math.sin(u*u); }


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

  t.setNoStyle();
  t.goTo(ax(min),ay(min)); t.turnTo(0,0);
  t.move(a);   t.defPoint("A");
  t.move(4*a); t.defPoint("B");
  t.defLine("cut","A","B");

  t.setNoStyle();
  t.beginPolygon(); 
  t.drawGraf("ax","ay");

  b=-a; a=-a;  max=-min; min=0;
  t.drawGraf("ax","ay");
  t.endPolygon(3);
 
  t.goTo(0,0); t.turnTo(0);
  t.setPolygon("cut",3);
  t.setPen("black",0.3);t.setBrush("orange");
  t.endPolygon()
  t.goTo(-40,-30);  t.drawPolygon();

//  min=min0; max=max0; a=a0; b=b0;
}
ScriptEnd#Arch2
____________________________________________


Fermatsche Spirale
=====================
ScriptBegin
var Grafik = "Script Funktionen";

var min = 0;
var max = 35*Math.PI;
var dt  = 0.01;

var a = 9.75; b = a;


function init()
{ t.setBrush("black");
  t.setPage(-210,80);
  t.setAntiAliasing();
}

function fx(x) {return x;}

function ax(u){ return a * Math.sqrt(u) * Math.cos(u) }
function ay(u){ return b * Math.sqrt(u) * Math.sin(u) }


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

  t.setNoStyle();
  t.beginPolygon(); 
  t.setPen("red",0.5);
  t.drawGraf("ax","ay");

  a=-a; b=-b; max = max - Math.PI;
  dt=-dt;
  t.goTo(ax(max),ay(max)); t.turnTo(0,0);

  t.setPen("green");
  t.drawGraf("ax","ay");

  t.setPen("black",-1);t.setBrush("orange");
  t.endPolygon()

  t.defDraw("Fermat");
  t.goTo(-105,-50); 
  t.draw("Fermat"); 
}
ScriptEnd#Ferm
____________________________________________



============================================
Fermatsche Spiralen 
============================================
ScriptBegin
var Grafik="Script Escher";

var a=5.5;
    Fill   ="black",  //"gray";//"crimson";//"yellow";
    Fill1  ="salmon"; //"hotpink";// "coral";//"orange";//"lightblue";
    Fill2  ="crimson";//"red";
    Fill3  ="gold";   //"lightblue";//"orange";//"darksalmon";//"crimson"

    maxi = 20;
    maxj = 20;

function init()
{ // Spirale definieren
  t.defScript("ScriptFerm","./Spiralen02.txt#Ferm");

  t.setBrush(Fill); t.setPage();
  t.setAntiAliasing();
} 

function draw()
{ t.goTo(-60,-65); t.turnTo(10); 
  t.setBrush(Fill1);
  t.morphDraw("Fermat",false);

  t.goTo(-60,80); t.turnTo(10); 
  t.setBrush(Fill2,1,230);
  t.morphDraw("Fermat",false); 

  t.goTo(70,-80); t.turnTo(38); 
  t.setBrush(Fill3,1,200);
  t.morphDraw("Fermat",false);
}


function morphX(x,y)
{// return x;
 return x*(a*Math.exp(-Math.sqrt(x*x+y*y)/25)+1);
}

function morphY(x,y)
{// return y;
 return y*(a*Math.exp(-Math.sqrt(x*x+y*y)/25)+1);
}

ScriptEnd#morph1
____________________________________________


============================================
Fermatsche Spirale auf Kugel
============================================

ScriptBegin
var Grafik="Script Escher";

var f=80;    // Abstand Ebene Kugelmittelpunkt
    v=105;   // Vergrösserung 

    Fill   = "dimgray"; //"gray";//"crimson";//"yellow";
    Fill1  = "gold";    //"lightblue";
    Fill2  = "white";
    Fill3  = "skyblue"; //"red";//"crimson"
    Fill4  = "red";     //"red";//
 

function init()
{ t.defScript("ScriptFerm","./Spiralen02.txt#Ferm");

  t.setGradient(-150,-70,150,70,"AntiqueWhite","black");
  t.setBrush("",15);
  t.setPage();
  t.setAntiAliasing(); 
} 


function draw() 
{
  t.goTo(-60,-65); t.turnTo(10); 
  t.setBrush(Fill1,1,210);
  t.morphDraw("Fermat",false);

  t.goTo(-80,80); t.turnTo(10); 
  t.setBrush(Fill2,1,200);
  t.morphDraw("Fermat",false); 
 
  t.goTo(90,-50); t.turnTo(90); 
  t.setBrush(Fill3,1,200);
  t.morphDraw("Fermat",false);
 
  t.goTo(-90,50); t.turnTo(170); 
  t.setBrush(Fill4,1);
  t.morphDraw("Fermat",false);
}


function morphX(x,y)
{// return x;
 d=Math.sqrt(x*x+y*y+f*f);
 return v*x/d
}

function morphY(x,y)
{// return y;
 d=Math.sqrt(x*x+y*y+f*f);
 return v*y/d
}

ScriptEnd#morph2
____________________________________________



Zwei Spiralen
=============

ScriptBegin
var Grafik = "Script Funktionen";
var min,max,dt;
var a,b,c;

function ax(u){ return a*Math.exp(b*u)*Math.cos(u);}
function ay(u){ return c*Math.exp(b*u)*Math.sin(u);}


function by(u){ return a * u * Math.cos(u*0.5);}
function bx(u){ return b * u * Math.sin(u); }


function init()
{ t.setBrush("black");
  t.setPage();
  t.setAntiAliasing();
}

function draw()
{ t.drawKoordSystem();

  min   = 30;
  max   = 160;
  dt    = 0.02;
  a     = 0.4;//1.5;
  b     = 0.04;//1.9;
  c     = 0.05; 

  t.setPen("YellowGreen", 0.4);
  //t.drawGraf("ax","ay",-78,-45);
  t.drawGraf("ax","ay",-70,-20);

  max = 520; a=0.2;
  t.setPen("red", 0.2);
  t.drawGraf("bx","by",-70,-20);
}

ScriptEnd#Log2
____________________________________________

