"; $hi=""; $bsg="border:1px solid lightblue;"; $onl=" onload='tdtitle();'"; if (trim(('' . $_SERVER['HTTP_REFERER'])) != '') { $emailbutton=""; $onl=""; $bsg=""; } if (strpos(strtolower(trim(('' . $_SERVER['HTTP_REFERER']))), "/itblog/") !== false) { $emailbutton="  "; $topp="parent"; $bsg="border:1px solid lightblue;"; } if (strpos(strtolower(trim(('' . $_SERVER['HTTP_REFERER']))), "/wordpress/") !== false) { $emailbutton="  "; $topp="parent"; $bsg="border:1px solid lightblue;"; } $xmove=-50; $ymove=-30; $zmove=10; $xscale=70; $yscale=220; $zscale=70; $xlight1=-300; $ylight1=0; $zlight1=-300; $xlight2=300; $ylight2=-300; $zlight2=-300; $radius=100; $radiusouter=100; $blight1r=100; $blight1g=100; $blight1b=255; $blight2r=100; $blight2g=255; $blight2b=100; $bgrd="#ffffff"; $bgrdr=255; $bgrdg=255; $bgrdb=255; $scol="#ffffff"; $sgrdr=255; $sgrdg=255; $sgrdb=255; $mcol="#ffffff"; $mgrdr=255; $mgrdg=255; $mgrdb=255; $mval="1.25"; $mvalh=""; $mchecked=""; $mc=""; $parentdot=""; $parentdotx=""; $topoverlay=" function emailit() { emailee=prompt(\"Enter email recipient (and can change default subject 'Image_3D Graphics' via |[subject] suffix)\", emailee); if (emailee == null) { emailee=''; } if (emailee.indexOf('@') != -1) { document.getElementById('emailto').value=emailee.split('|')[0]; if (emailee.indexOf('|') == -1) { document.getElementById('subject').value='Image_3D Graphics'; } else { document.getElementById('subject').value=emailee.split('|')[1]; } var prehcontis='' + document.head.innerHTML + ''; var hcontis=document.body.innerHTML + ''; var thdsh=hcontis.split(''); //hcontis=hcontis.replace(thdsh[0], thdsh[0].replace(/ title\=/g, ' TITLE=')); var duris=hcontis.split(' title=\"data:'); for (var ij=1; ij'); var xhh=xh[0].replace(/\'; document.getElementById('td_' + infv).style.display='table-cell'; } " . $topoverlay . " "; $driversel=str_replace(">" . strtoupper($driver) . "<", " selected>" . strtoupper($driver) . "<", ""); $perspectivesel=str_replace(">" . $pspect . "<", " selected>" . $pspect . "<", ""); $lightsel1=str_replace(">" . $alight1 . "<", " selected>" . $alight1 . "<", ""); $lightsel2=str_replace(">" . $alight2 . "<", " selected>" . $alight2 . "<", ""); $selstuff=""; for ($ii=0; $ii", "", $selstuff); } for ($ii=0; $ii
" . $hi . "


  " . $emailbutton . "  " . str_replace(" Height:

Shape Base Colour:
Background Colour:
Metal
Base Colour:

" . str_replace("

Light1 x: Light1 y: Light1 z:
Light2 x: Light2 y: Light2 z:

" . str_replace("
Tilt Left/Right [gamma or roll]:
Tilt Front/Back [beta or pitch]:
Bearing [alpha or yaw]:

Scale x: Scale y: Scale z:

Move x: Move y: Move z:

Detail: Detail 2:

Radius/Length: Outer Radius: "); $emailbutton=""; } $htmlforms.="
"; if (!$metal && ($shape == "cone" || $shape == "") && $textx == "") { $delim=""; if ($arg) { foreach ($argv as $arg) { $e=explode("=",$arg); if (count($e) == 2) { $textx.=$delim . $e[1]; switch (strtolower(trim($textx))) { case "cone": $shape=strtolower(trim($textx)); $textx=""; break; case "torus": $shape=strtolower(trim($textx)); $textx=""; break; case "sphere": $shape=strtolower(trim($textx)); $textx=""; break; case "cube": $shape=strtolower(trim($textx)); $textx=""; break; case "bundt": $shape=strtolower(trim($textx)); $textx=""; break; case "helicoid": $shape=strtolower(trim($textx)); $textx=""; break; case "star": $shape=strtolower(trim($textx)); $textx=""; break; case "spherocube": $shape=strtolower(trim($textx)); $textx=""; break; } } else { $textx.=$delim . $e[0]; } if ($delim == "") { $textx=""; } $delim=" "; } if ($textx != "") { $textx=trim($textx); if ($textx != "") { $shape=""; } } } } $world = new Image_3D(); $world->setColor(new Image_3D_Color($bgrdr,$bgrdg,$bgrdb)); // A blue light from the left //$light1 = $world->createLight($alight1,array(-300,0,-300)); $light1 = $world->createLight($alight1,array($xlight1,$ylight1,$zlight1)); $light1->setColor(new Image_3D_Color($blight1r,$blight1g,$blight1b)); // A green light from the upper-right //$light2 = $world->createLight($alight2,array(300,-300,-300)); $light2 = $world->createLight($alight2,array($xlight2,$ylight2,$zlight2)); $light2->setColor(new Image_3D_Color($blight2r,$blight2g,$blight2b)); switch ($shape) { case "cone": //$cone = $world->createObject('cone',array('detail' => 64)); $cone = $world->createObject('cone',array('detail' => $detail)); if ($metal) { $cone->setColor($metal); } else { $cone->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } //$cone->transform($world->createMatrix('scale', array(70, 220, 70))); $cone->transform($world->createMatrix('scale', array($xscale, $yscale, $zscale))); //$cone->transform($world->createMatrix('rotation',array(-45, -120, -10))); $cone->transform($world->createMatrix('rotation',array($roll, $pitch, $yaw))); //$cone->transform($world->createMatrix('move', array(-50, -30, 10))); $cone->transform($world->createMatrix('move', array($xmove, $ymove, $zmove))); break; case "torus": //$torus = $world->createObject('torus', array('inner_radius' => 90,'outer_radius' => 120,'detail_1' => 10,'detail_2' => 10)); $torus = $world->createObject('torus', array('inner_radius' => $radius,'outer_radius' => $radiusouter,'detail_1' => $detail,'detail_2' => $detail2)); if ($metal) { $torus->setColor($metal); } else { $torus->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } //$torus->transform($world->createMatrix('Rotation', array(-45,0,-30))); $torus->transform($world->createMatrix('Rotation', array($roll,$pitch,$yaw))); //$torus->transform($world->createMatrix('Move', array(0,-20,0))); $torus->transform($world->createMatrix('move', array($xmove, $ymove, $zmove))); break; case "cube": //$cube = $world->createObject('cube',array(100, 100, 100)); $cube = $world->createObject('cube',array($radius, $radius, $radius)); if ($metal) { $cube->setColor($metal); } else { $cube->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } //$cube->transform($world->createMatrix('rotation',array(-60,60,40))); $cube->transform($world->createMatrix('rotation',array($roll,$pitch,$yaw))); break; case "sphere": //$sphere = $world->createObject('sphere',array('r' => 85, 'detail' => 5)); $sphere = $world->createObject('sphere',array('r' => $radius, 'detail' => $detail)); if ($metal) { $sphere->setColor($metal); } else { $sphere->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } break; case "bundt": $map = $world->createObject('map'); $scale = 130; //$detail = 15; //35; $increment = 1 / $detail; for ($r = 0; $r <= 1; $r += $increment) { $row = array(); for ($t = 0; $t <= (2 * pi()); $t += $increment) { $row[] = new Image_3D_Point( $scale * ($r * cos($t)), $scale * ($r * sin($t)), $scale * (sin(4 * pi() * $r)) ); } $map->addRow($row); } if ($metal) { $map->setColor($metal); } else { $map->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } //$map->transform($world->createMatrix('Rotation', array(-45, 0, -15))); $map->transform($world->createMatrix('Rotation', array($roll, $pitch, $yaw))); break; case "helicoid": $map = $world->createObject('map'); $scale = 120; //$detail = 10; //30; $levels = 6; $increment = 1 / $detail; for ($s = 0; $s <= 1; $s += $increment) { $row = array(); for ($t = 0; $t <= $levels; $t += $increment) { $row[] = new Image_3D_Point( $scale * ($s * cos(2 * pi() * $t)), // x $scale * ($s * sin(2 * pi() * $t)), // y $scale * ($t) // z ); } $map->addRow($row); } if ($metal) { $map->setColor($metal); } else { $map->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } //$map->transform($world->createMatrix('Rotation', array(-50, 0, 15))); $map->transform($world->createMatrix('Rotation', array($roll, $pitch, $yaw))); //$map->transform($world->createMatrix('Move', array(50, -220, 0))); $map->transform($world->createMatrix('move', array($xmove, $ymove, $zmove))); break; case "star": $polygons = array(); // Front face $polygons[] = array( array(0, -120, 0), array(-18, -12, 0), array(-86, 48, 0), array(0, 18, 0), array(86, 48, 0), array(18, -12, 0) ); // Back face $polygons[] = array( array(0, -120, 60), array(-18, -12, 60), array(-86, 48, 60), array(0, 18, 60), array(86, 48, 60), array(18, -12, 60) ); // 3 Sides $polygons[] = array( array(0, -120, 0), array(-18, -12, 0), array(-86, 48, 0), array(-86, 48, 60), array(-18, -12, 60),array(0, -120, 60) ); $polygons[] = array( array(-86, 48, 0), array(0, 18, 0), array(86, 48, 0), array(86, 48, 60), array(0, 18, 60), array(-86, 48, 60) ); $polygons[] = array( array(86, 48, 0), array(18, -12, 0), array(0, -120, 0), array(0, -120, 60), array(18, -12, 60),array(86, 48, 60) ); foreach ($polygons as $poly) { $points = array(); foreach ($poly as $set) { $points[] = new Image_3D_Point($set[0], $set[1], $set[2]); } $p = $world->createObject('polygon', $points); if ($metal) { $p->setColor($metal); } else { $p->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } } //$world->transform($world->createMatrix('Rotation',array(0, -25, -15))); $world->transform($world->createMatrix('Rotation',array($roll, $pitch, $yaw))); break; case "spherocube": for ($x=0; $x < 5; $x++) { for ($y=0; $y < 5; $y++) { for ($z=0; $z < 5; $z++) { $sphere = $world->createObject('sphere',array('r' => 25, 'detail' => 2)); if ($metal) { $sphere->setColor($metal); } else { $sphere->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } $sphere->transform($world->createMatrix('Move',array($x * 75, $y * 75, $z * 75))); //$sphere->transform($world->createMatrix('Rotation',array(45, 30, 15))); $sphere->transform($world->createMatrix('Rotation',array($roll, $pitch, $yaw))); } } } //$world->transform($world->createMatrix('Move', array(-225, -100, 0))); $world->transform($world->createMatrix('move', array($xmove, $ymove, $zmove))); break; default: if ($textx != "") { if (file_exists('Image/3D/Paintable/Object/TextData.dat')) { file_put_contents('Image/3D/Paintable/Object/TextData.dat', $textx); } $text = $world->createObject('text', $textx); if ($metal) { $text->setColor($metal); } else { $text->setColor(new Image_3D_Color($sgrdr,$sgrdg,$sgrdb)); } //$text->transform($world->createMatrix('Scale', array(6, 6, 6))); $text->transform($world->createMatrix('Scale', array($xscale, $yscale, $zscale))); //$text->transform($world->createMatrix('Rotation',array(-35, 30, -15))); $text->transform($world->createMatrix('Rotation',array($roll, $pitch, $yaw))); //$text->transform($world->createMatrix('Move', array(-150, 10, 20))); $text->transform($world->createMatrix('move', array($xmove, $ymove, $zmove))); } break; } // Render and save the 2-D image //$world->createRenderer('Perspectively'); $world->createRenderer($pspect); //$world->createDriver('gd'); $world->createDriver($driver); $world->render($width, $height, 'object' . $shape . $ext); //header ('Content-type:image/png'); //echo file_get_contents('object' . $shape . '.png'); if ($isget) { echo str_replace(" id=", " style=display:none; id=",$hi); //str_replace("BLOCK","none",$htmlforms); } else { echo $htmlforms; } ?>