Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/functions/povobject.inc
AAAAAAAAAAAAAAAAAAAAAAAAA
//
// to place objects in a 3D space.
// object {column_tuscan}
// object {column_doric}
// object {column_ionic}
// object {column_corinthian}
// object {column_composite}
//
function povobject($image,$direction,$item,$scale,$x,$y) {
    if ($item=="toilet") {
        $zcolor = ImageColorAllocate($image,250,250,220);
    }
    if (($item=="tuscan") or ($item=="doric") or ($item=="ionic") or ($item=="corinthian")
        or ($item=="composite")) {
         $zcolor = ImageColorAllocate($image,200,200,200);
    }
    if ($item=="palm") {
        $zcolor = ImageColorAllocate($image,115,183,73);
    }
    if ($item=="cooler") {
        $zcolor = ImageColorAllocate($image,185,185,255);
    }
    $x=$x*$scale;
    $y=$y*$scale;
    $radius=.8*$scale;
    for($i=0; $i<=$radius; ++$i) {
        ImageArc($image,$x,$y,$i,$i,0,360,$zcolor);
    }
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCC
function povobject($image,$direction,$item,$scale,$x,$y)
{
    global $zz;
if ($direction=="L") $z="<0,90,0>";
if ($direction=="R") $z="<0,270,0>";
if ($direction=="U") $z="<0,0,0>";
if ($direction=="D") $z="<0,180,0>";

if ($direction=="L") $t="<$x,0,$y>";
if ($direction=="R") $t="<$x,0,$y>";
if ($direction=="U") $t="<$x,0,$y>";
if ($direction=="D") $t="<$x,0,$y>";

if ($item=="toilet") {
$ot="
object { toilet
rotate $z
translate $t }
";
    fwrite($zz,$ot);
}

// note these are columns
if (($item=="tuscan") or ($item=="doric") or ($item=="ionic") or ($item=="corinthian")
    or ($item=="composite")) {
    $ot="
object { column_$item
scale <3,3,3>
translate $t }
";
    fwrite($zz,$ot);
}

if ($item=="palm") {
$ot="
#declare r1 = seed(1);
#declare i=39;
#while (i<40)
#declare position=<$x,12,$y>;
// start of a single palm tree
palmtree(position)
#declare i=i+1;
#end
";
    fwrite($zz,$ot);
}


if ($item=="cooler") {
$ot="
object {
        cooler
        rotate $z
        translate $t
        }
";
    fwrite($zz,$ot);
}
}


DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "no";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program