public function __construct($options) { parent::__construct(); $inner_radius = (double) $options['inner_radius']; $outer_radius = (double) $options['outer_radius']; $r1 = ($outer_radius - $inner_radius) / 2; $r2 = $inner_radius + $r1; $d1 = (int) round(max(1, $options['detail_1']) * 4); $d2 = (int) round(max(1, $options['detail_2']) * 4); $rings = array(); for ($i = 0; $i < $d1; ++$i) { $rings[$i] = array(); for ($j = 0; $j < $d2; ++$j) { $_i = $i / $d1; $_j = $j / $d2; $z = cos($_j * pi() * 2) * $r1; $z2 = sin($_j * pi() * 2) * $r1; $x = ($r2 + $z2) * cos($_i * pi() * 2); $y = ($r2 + $z2) * sin($_i * pi() * 2); $rings[$i][] = new Image_3D_Point($x, $y, $z); } } foreach ($rings as $i => $ring) { $i_next = ($i + 1) % count($rings); foreach ($ring as $j => $point) { $j_next = ($j + 1) % count($ring); $this->_addPolygon(new Image_3D_Polygon($rings[$i_next][$j], $rings[$i][$j], $rings[$i][$j_next])); $this->_addPolygon(new Image_3D_Polygon($rings[$i_next][$j], $rings[$i][$j_next], $rings[$i_next][$j_next])); } } }
public function __construct($parameter) { parent::__construct(); $x = (double) @$parameter[0]; $y = (double) @$parameter[1]; $z = (double) @$parameter[2]; $this->_points = array(); $this->_points[1] = new Image_3D_Point(-$x / 2, -$y / 2, -$z / 2); $this->_points[2] = new Image_3D_Point(-$x / 2, -$y / 2, $z / 2); $this->_points[3] = new Image_3D_Point(-$x / 2, $y / 2, -$z / 2); $this->_points[4] = new Image_3D_Point(-$x / 2, $y / 2, $z / 2); $this->_points[5] = new Image_3D_Point($x / 2, -$y / 2, -$z / 2); $this->_points[6] = new Image_3D_Point($x / 2, -$y / 2, $z / 2); $this->_points[7] = new Image_3D_Point($x / 2, $y / 2, -$z / 2); $this->_points[8] = new Image_3D_Point($x / 2, $y / 2, $z / 2); // Oben & Unten $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[4], $this->_points[8])); $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[8], $this->_points[7])); $this->_addPolygon(new Image_3D_Polygon($this->_points[2], $this->_points[1], $this->_points[6])); $this->_addPolygon(new Image_3D_Polygon($this->_points[1], $this->_points[5], $this->_points[6])); // Links & Rechts $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[2], $this->_points[4])); $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[1], $this->_points[2])); $this->_addPolygon(new Image_3D_Polygon($this->_points[8], $this->_points[5], $this->_points[7])); $this->_addPolygon(new Image_3D_Polygon($this->_points[8], $this->_points[6], $this->_points[5])); // Rueck- & Frontseite $this->_addPolygon(new Image_3D_Polygon($this->_points[2], $this->_points[8], $this->_points[4])); $this->_addPolygon(new Image_3D_Polygon($this->_points[2], $this->_points[6], $this->_points[8])); $this->_addPolygon(new Image_3D_Polygon($this->_points[1], $this->_points[7], $this->_points[5])); $this->_addPolygon(new Image_3D_Polygon($this->_points[1], $this->_points[3], $this->_points[7])); }
public function __construct($points) { parent::__construct(); $polygon = new Image_3D_Polygon(); foreach ($points as $point) { $polygon->addPoint($point); } $this->_addPolygon($polygon); }
public function __construct($file) { parent::__construct(); $this->_points = array(); $this->_chunks = array(); $this->_objects = array(); if (!is_file($file) || !is_readable($file)) { throw new exception('3ds file could not be loaded.'); } $this->_file = $file; $this->_readChunks(); }
public function __construct($options) { parent::__construct(); $this->_lines = array(); $this->_points = array(); $this->_virtualPolygon = array(); $this->_radius = (double) @$options['r']; $detail = (int) @$options['detail']; $this->_createTetraeder(); for ($step = 0; $step < $detail; $step++) { $this->_sierpinsky(); } $this->_getRealPolygones(); }
public function __construct($string) { parent::__construct(); $this->_text = (string) $string; $this->_points = array(); $this->_characterSpacing = 5.5; $textdata = '@data_dir@/Image_3D/data/TextData.dat'; if (is_readable($textdata)) { $this->_chars = unserialize(file_get_contents($textdata)); } elseif (is_readable('data/TextData.dat')) { $this->_chars = unserialize(file_get_contents('data/TextData.dat')); } else { throw new Exception('File for textdata not found.'); } $this->_generateCubes(); }
public function __construct($parameter) { parent::__construct(); $radius = 1; $height = 1; $detail = max(3, (int) $parameter['detail']); // Generate points according to parameters $top = new Image_3D_Point(0, $height, 0); $bottom = new Image_3D_Point(0, 0, 0); $last = new Image_3D_Point(1, 0, 0); $points[] = $last; for ($i = 1; $i <= $detail; ++$i) { $actual = new Image_3D_Point(cos(deg2rad(360 * $i / $detail)), 0, sin(deg2rad(360 * $i / $detail))); $points[] = $actual; // Build polygon $this->_addPolygon(new Image_3D_Polygon($top, $last, $actual)); $this->_addPolygon(new Image_3D_Polygon($bottom, $last, $actual)); $last = $actual; } // Build closing polygon $this->_addPolygon(new Image_3D_Polygon($top, $last, $points[0])); $this->_addPolygon(new Image_3D_Polygon($bottom, $last, $points[0])); }
/** * Get and merge polygones * * Get polygones and points from an object and merge them unique to local * polygon- and pointarrays. * * @param Image_3D_Object $object Object to merge * * @return void */ protected function _getPolygones(Image_3D_Object $object) { $newPolygones = $object->getPolygones(); $this->_polygones = array_merge($this->_polygones, $newPolygones); // Add points unique to points-Array foreach ($newPolygones as $polygon) { $points = $polygon->getPoints(); foreach ($points as $point) { if (!$point->isProcessed()) { $point->processed(); array_push($this->_points, $point); } } } }
public function setOption($option, $value) { // if ($option === Image_3D::IMAGE_3D_OPTION_BF_CULLING) $value = false; parent::setOption($option, $value); }
public function __construct() { parent::__construct(); $this->_points = array(); }