Location: PHPKode > projects > PHP Cad and Drawing Program > functions/flatroof.inc
AAAAAAAAAAAAAAAAAAAAAAAAA
//
//    Draws a roof in pov-ray, puts ticks down in 2D.
//    Direction is necessary when I make pitched roof function
//    in pov-ray.
//
//    $direction = <u>"R"</u> for right,
//    x,y is lower left if going right.
//    $direction = <u>"D"</u> for down,
//    x,y is or upper left going down.
//
function flatroof($image, $direction, $u, $v, $scale, $x, $y)
{
$roofline=ImageColorAllocate($image,210,210,0);
    if ($direction == "R") {
        imagesetpixel ($image,$x*$scale,$y*$scale+$scale-2,$roofline);
        imagesetpixel ($image,$x*$scale,$y*$scale+$scale-1,$roofline);
        imagesetpixel ($image,$x*$scale,$y*$scale+$scale,$roofline);
        imagesetpixel ($image,$x*$scale+1,$y*$scale+$scale,$roofline);
        imagesetpixel ($image,$x*$scale+2,$y*$scale+$scale,$roofline);
        imagesetpixel ($image,$x*$scale+3,$y*$scale+$scale,$roofline);

        imagesetpixel ($image,$u*$scale+$scale,$v*$scale+2,$roofline);
        imagesetpixel ($image,$u*$scale+$scale,$v*$scale+1,$roofline);
        imagesetpixel ($image,$u*$scale+$scale,$v*$scale,$roofline);
        imagesetpixel ($image,$u*$scale+($scale-1),$v*$scale,$roofline);
        imagesetpixel ($image,$u*$scale+($scale-2),$v*$scale,$roofline);
    }
    if ($direction == "D") {
        imagesetpixel ($image,$x*$scale,$y*$scale+3,$roofline);
        imagesetpixel ($image,$x*$scale,$y*$scale+2,$roofline);
        imagesetpixel ($image,$x*$scale,$y*$scale+1,$roofline);
        imagesetpixel ($image,$x*$scale,$y*$scale,$roofline);
        imagesetpixel ($image,$x*$scale+1,$y*$scale,$roofline);
        imagesetpixel ($image,$x*$scale+2,$y*$scale,$roofline);

        imagesetpixel ($image,$u*$scale+$scale,$v*$scale+$scale-2,$roofline);
        imagesetpixel ($image,$u*$scale+$scale,$v*$scale+$scale-1,$roofline);
        imagesetpixel ($image,$u*$scale+$scale,$v*$scale+$scale,$roofline);
        imagesetpixel ($image,$u*$scale+($scale-1),$v*$scale+$scale,$roofline);
        imagesetpixel ($image,$u*$scale+($scale-2),$v*$scale+$scale,$roofline);
    }
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
if ($PObj == "flatroof") {
    if ($xx !="" and $yy !="" and $u !="" and $v !="") {
        $a=fopen("./files/$pfilez", "a");
        $xp = "<?php " . $PObj . "($" . "image,";
        $xp .= '"' . $PDir . '",';
        $xp .= $u . "," . $v . ",";
        $xp .= "$" . "scale," . $xx . "," . $yy . "); ?>\n";
        $yy++;
        fwrite($a, $xp);
        fclose($a);
    }
}
CCCCCCCCCCCCCCCCCCCCCCCC
function flatroof($image,$direction,$u,$v,$scale,$x,$y)
{
global $floor;
global $twall;
global $tfoundation;
global $troof;
global $zz;
if ($direction == "R") {
    $a = "box{<";
    $a .= $u+1 . "," . (9+$floor) . ",";
    $a .= $v . "><";
    $a .= $x;
    $a .= "," . (11+$floor) . ",";
    $a .= $y+1;
    $a .= "> $troof}\n";
    fwrite($zz,$a);
} else {
    $a = "box{<";
    $a .= $u+1 . "," . (9+$floor) . ",";
    $a .= $v+1 . "><";
    $a .= $x;
    $a .= "," . (11+$floor) . ",";
    $a .= $y;
    $a .= "> $troof}\n";
    fwrite($zz,$a);
}
}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "yes";
$dirlist= array("R","D");
$lenlist= array("NA");
$txtitem="";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program