function draw_pyramid ($image_size, $degree_x, $degree_y, $degree_z, $vdist, $dist, $vertex_color, $side_color, $wireframe, $dashes
{
$degree_x = $degree_x % 360;
$degree_y = $degree_y % 360;
$degree_z = $degree_z % 360;
// construct the cube polygons
$size = 400; // the size is arbitrary
$x1$size/2;
$x0$x1*-1;
$y1$size/2;
$y0$y1*-1;
$z1$size/2;
$z0$z1*-1;
$sides = array();
$sides[] = array$x0$y0$z0, 0,0,$z1, $x0$y1$z0);
$sides[] = array$x1$y0$z0, 0,0,$z1, $x1$y1$z0);
$sides[] = array$x0$y0$z0, 0,0,$z1, $x1$y0$z0);
$sides[] = array$x0$y1$z0, 0,0,$z1, $x1$y1$z0);
$sides[] = array$x0$y0$z0, $x0$y1$z0, $x1$y1$z0, $x1$y0$z0);
// project each of the 6 polygons that makes up the cube
for ($i=0; $icount$sides); $i++) {
$points[] = project_polygon$sides$i], $degree_x, $degree_y, $degree_z, 0, 0, 0, $vdist+($size/2), $dist+($size/2), true);
}
// scale the image somewhat
$scale = $image_size/($size*1.3);
return render_polygons$points, $vertex_color, $side_color, $wireframe, $dashes, $image_size, $scale);
}