\n";
$poly="0 0 ";
$x=0;
$y=0;
# Ableitungen:
$xabl=900/$anz;
$yabl=-400*2.0*M_PI/$anz;
# erster Kontrollpunkt
$kx=round($x+$xabl/3.0,1);
$ky=round($y+$yabl/3.0,1);
$pfad1="M 0, 0 C $kx,$ky ";
# Schleife fuer die weiteren Punkte
for ($i = 1; $i <= $anz; $i++) {
# Randpunkt
$x=$i*900/$anz;
$y=-400*sin(2.0*M_PI*$i/$anz);
# Ableitung fuer y, die fuer x ist in diesem Beispiel
#konstant und muss nicht nochmal gerechnet werden
$yabl=-400*2.0*M_PI/$anz*cos(2.0*M_PI*$i/$anz);
# zweiten Kontrollpunkt rechnen
# das Runden ist wichtig, damit die svg-Ausgabe nicht
# unnoetig gross wird...
$kx=round($x-$xabl/3.0,1);
$ky=round($y-$yabl/3.0,1);
# automatische stetig differenzierbare Fortsetzung
# fordern
if ($i==2){
$pfad1 .="S ";
}
$pfad1 .="$kx,$ky ";
$px=round($x,1);
$py=round($y,1);
# Kontrollpunkte und Endpunkte
$einzelpunkte .="\n";
$pfad1 .="$px,$py \n";
$poly .="$px,$py \n";
}
# Nochmal das gleiche mit 100 Kurvenstuecken:
$anz=100;
$x=0;
$y=0;
$xabl=900/$anz;
$yabl=-400*2.0*M_PI/$anz;
$kx=round($x+$xabl/3.0,1);
$ky=round($y+$yabl/3.0,1);
$pfad2="M 0, 0 C $kx,$ky ";
for ($i = 1; $i <= $anz; $i++) {
$x=$i*900/$anz;
$y=-400*sin(2.0*M_PI*$i/$anz);
$yabl=-400*2.0*M_PI/$anz*cos(2.0*M_PI*$i/$anz);
$kx=round($x-$xabl/3.0,1);
$ky=round($y-$yabl/3.0,1);
if ($i==2){
$pfad2 .="S ";
}
$pfad2 .="$kx,$ky ";
$px=round($x,1);
$py=round($y,1);
$pfad2 .="$px,$py \n";
}
# svg-header senden:
$content="Content-type: image/svg+xml";
header($content);
# xml-Zeile ausgeben
echo "";
# und jetzt das Dokument
?>