Imagepolygon Stars (Now with pic) [56K WARNING]
Posted: Mon Jan 24, 2005 1:48 pm
I'm on a roll here. Playing with imagepolygon() stuff, I came up with a nice function to make stars..
Small isue with it at the moment coz it doesn't work with the rotatePolygon() function I posted yesterday. I'll fix it eventually. Unless someone else does.
Made a groovy pic using this function:

Code: Select all
function star($number_of_points,$outer_radius=100,$inner_radius=40) {
$p = array();
$degrees = 360/($number_of_points*2);
for ($i=0;$i<$number_of_points*2;$i++) {
$cos = cos(deg2rad($degrees*$i));
$sin = sin(deg2rad($degrees*$i));
$x = 0;
$y = ($i%2==0)?$outer_radius:$inner_radius;
$pї] = $cos*($x) - $sin*($y);
$pї] = $sin*($x) + $cos*($y);
}
return $p;
}Made a groovy pic using this function:
