Kaity's Unique Drawing
FIRST SLAVE CODE FOLLOWS
<?php // PHP slave script drawing complex functions
// create a blank image that is 200 pixels wide and 200 pixels tall
$image = imagecreate(200, 200);
// create a color and fill (paint) the work area
// set the color RGB (255, 255, 255), which is WHITE
$white = imagecolorallocate($image, 255, 255, 255);
// fill the entire image
imagefilledrectangle($image, 0, 0, 200, 200, $white);
// === first function
// create another color
$brown = imagecolorallocate($image, 100, 20, 50);
// init vars
$center = 100;
$PI = 2 * pi();
$a = 3;
$b = 1;
$m = 10;
$n1 = 4;
$n2 = 6;
$n3 = 40;
// create the graphic
for($f = 0; $f <= $PI; $f += 0.0001)
{
$r= pow((pow(abs(cos($m*$f/4)/$a),$n2) + pow(abs(sin($m*$f/4)/$b), $n3)), -(1/$n1));
$x = $center + $r * cos ($f) * 35;
$y = $center + $r * sin ($f) * 35;
imagesetpixel($image, $x, $y, $brown);
}
// create yet another color
$blue = imagecolorallocate($image, 0, 100, 200);
// === second function
// change vars
$a = 1;
$b = 2;
$m = 6;
$n1 = 4;
$n2 = 6;
$n3 = 20;
// create another graphic and place it over the original graphic
for($f = 0; $f <= $PI; $f += 0.0001)
{
$r= pow((pow(abs(cos($m*$f/4)/$a),$n2) + pow(abs(sin($m*$f/4)/$b), $n3)), -(1/$n1));
$x = $center + $r * cos ($f) * 35;
$y = $center + $r * sin ($f) * 35;
imagesetpixel($image, $x, $y, $blue);
}
// create yet another color
$pink = imagecolorallocate($image, 255, 0, 200);
// === third function
// change vars
$a = 3;
$b = 5;
$m = 2;
$n1 = 7;
$n2 = 5;
$n3 = 40;
// create another graphic and place it over the original graphic
for($f = 0; $f <= $PI; $f += 0.0001)
{
$r= pow((pow(abs(cos($m*$f/4)/$a),$n2) + pow(abs(sin($m*$f/4)/$b), $n3)), -(1/$n1));
$x = $center + $r * cos ($f) * 35;
$y = $center + $r * sin ($f) * 35;
imagesetpixel($image, $x, $y, $pink);
}
// tell the server what's coming, deliver it, and destroy it
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>