public function drawPolygon(Image_3D_Polygon $polygon) { // Get points $points = $polygon->getPoints(); $coords = array(); foreach ($points as $point) { $coords = array_merge($coords, $point->getScreenCoordinates()); } $coordCount = (int) (count($coords) / 2); if (true) { imageFilledPolygon($this->_image, $coords, $coordCount, $this->_getColor($polygon->getColor())); } else { imagePolygon($this->_image, $coords, $coordCount, $this->_getColor($polygon->getColor())); } }
public function drawPolygon(Image_3D_Polygon $polygon) { $list = ''; $points = $polygon->getPoints(); foreach ($points as $point) { $pointarray = $point->getScreenCoordinates(); $list .= sprintf('%.2f,%.2f ', $pointarray[0], $pointarray[1]); } $this->_addPolygon(sprintf("\t<polygon points=\"%s\" style=\"%s\" />\n", substr($list, 0, -1), $this->_getStyle($polygon->getColor()))); }
public function drawPolygon(Image_3D_Polygon $polygon) { // Build pointarray $pointArray = array(); $points = $polygon->getPoints(); foreach ($points as $point) { $screenCoordinates = $point->getScreenCoordinates(); $this->_image->addVertex(array('x' => $screenCoordinates[0], 'y' => $screenCoordinates[1])); } $this->_image->setFillColor($this->_getColor($polygon->getColor())); $this->_image->setLineColor(false); $this->_image->polygon(array('connect' => true)); }
public function drawPolygon(Image_3D_Polygon $polygon) { // Get points $points = $polygon->getPoints(); $coords = array(); $coords = ''; foreach ($points as $point) { $pointCoords = $point->getScreenCoordinates(); $coords .= (int) $pointCoords[0] . ',' . (int) $pointCoords[1] . ' '; } $command = '-fill ' . escapeshellarg($this->_getColor($polygon->getColor())); $command .= ' -draw ' . escapeshellarg('polygon ' . trim($coords)); $this->_commandQueue[] = $command; }
public function drawPolygon(Image_3D_Polygon $polygon) { $points = $this->_getPolygonOutlines($polygon->getPoints()); foreach ($points as $x => $row) { if (count($row) < 2) { continue; } $start = min(array_keys($row)); $end = max(array_keys($row)); // Starting point $this->_heigth[$x][$start] = $this->_getColor($polygon->getColor()); // the way between for ($y = $start + 1; $y < $end; ++$y) { $this->_heigth[$x][$y] = $this->_getColor($polygon->getColor()); } // Ending point $this->_points[$x][$end] = $this->_getColor($polygon->getColor()); } }
public function drawPolygon(Image_3D_Polygon $polygon) { $points = $this->_getPolygonOutlines($polygon->getPoints()); foreach ($points['coverage'] as $x => $row) { if (count($row) < 2) { continue; } $start = min(array_keys($row)); $end = max(array_keys($row)); $zStart = $points['height'][$x][$start]; $zEnd = $points['height'][$x][$end]; $zStep = ($zEnd - $zStart) / ($end - $start); // Starting point $this->_heigth[$x][$start][(int) ($zStart * 100)] = $this->_getColor($polygon->getColor(), $points['coverage'][$x][$start]); // the way between for ($y = $start + 1; $y < $end; $y++) { $this->_heigth[$x][$y][(int) (($zStart + $zStep * ($y - $start)) * 100)] = $this->_getColor($polygon->getColor()); } // Ending point $this->_points[$x][$end][(int) ($zEnd * 100)] = $this->_getColor($polygon->getColor(), $points['coverage'][$x][$end]); } }
public function drawPolygon(Image_3D_Polygon $polygon) { $list = ''; $points = $polygon->getPoints(); $svg = "\t\t\t<polygon id=\"[id]\" "; //Image_3D_P // number of points $svg .= 'nop="' . count($points) . '" '; // coordinates on start foreach ($points as $nr => $point) { $svg .= 'x' . $nr . '="' . round($point->getX()) . '" '; $svg .= 'y' . $nr . '="' . round($point->getY()) . '" '; $svg .= 'z' . $nr . '="' . round($point->getZ()) . '" '; } $svg .= 'style="' . $this->_getStyle($polygon->getColor()) . "\" />\n"; $this->_addPolygon($svg); }
/** * Draw a specified polygon * * @param Image_3D_Polygon $polygon Polygon to draw * * @return void */ public function drawPolygon(Image_3D_Polygon $polygon) { $pointarray = array(); $points = $polygon->getPoints(); foreach ($points as $key => $point) { $pointarray[$key] = array('x' => $point->getX(), 'y' => $point->getY(), 'z' => $point->getZ()); } $this->_addPolygon($pointarray, array($this->_getRgba($polygon->getColor()), null, null)); }