Compute the polygon corresponding to the cell

@return Polygon of the cell
967671
private Polygon getCellPolygon() {
        final Coordinate[] summits = new Coordinate[5];
        double x1 = minX + cellI * deltaX;
        double y1 = minY + cellJ * deltaY;
        double x2 = minX + (cellI + 1) * deltaX;
        double y2 = minY + (cellJ + 1) * deltaY;
        summits[0] = new Coordinate(x1, y1);
        summits[1] = new Coordinate(x2, y1);
        summits[2] = new Coordinate(x2, y2);
        summits[3] = new Coordinate(x1, y2);
        summits[4] = new Coordinate(x1, y1);
        final LinearRing g = GF.createLinearRing(summits);
        final Polygon gg = GF.createPolygon(g, null);
        cellI++;
        return gg;
    }
498933
def get_datatypes(self):
        
        datatypes = set()
        for element in self.elements:
            if isinstance(element, PolygonSet):
                datatypes.update(element.datatypes)
            elif isinstance(element, CellReference) or isinstance(
                    element, CellArray):
                datatypes.update(element.ref_cell.get_datatypes())
        return datatypes
587625
private function polyhedralSurface()
    {
        $values = array();
        $count  = $this->readCount();

        for ($i = 0; $i < $count; $i++) {
            $this->readByteOrder();

            $type = $this->readType();

            switch ($type) {
                case ($this->getDimensionedPrimitive(self::WKB_TYPE_POLYGON)):
                    $value = $this->polygon();
                    break;
                // is polygon the only one?
                default:
                    throw new UnexpectedValueException($this->getBadTypeInTypeMessage($type, self::WKB_TYPE_POLYHEDRALSURFACE, array(self::WKB_TYPE_POLYGON)));
            }

            $values[] = array(
                'type'  => $this->getTypeName($type),
                'value' => $value,
            );
        }

        return $values;
    }
461166
private static double computePerimeter(Geometry geometry) {
        double sum = 0;
        for (int i = 0; i < geometry.getNumGeometries(); i++) {
            Geometry subGeom = geometry.getGeometryN(i);
            if (subGeom instanceof Polygon) {
                sum += ((Polygon) subGeom).getExteriorRing().getLength();
            } 
        }
        return sum;
    }
67970
public List<Polygon2D_F64> getPolygons( @Nullable List<Polygon2D_F64> storage ,
											@Nullable List<DetectPolygonFromContour.Info> storageInfo ) {
		if( storage == null )
			storage = new ArrayList<>();
		else
			storage.clear();

		if( storageInfo != null )
			storageInfo.clear();

		List<DetectPolygonFromContour.Info> detections = detector.getFound().toList();
		for (int i = 0; i < detections.size(); i++) {
			DetectPolygonFromContour.Info d = detections.get(i);

			if( d.computeEdgeIntensity() >= minimumRefineEdgeIntensity ) {
				storage.add(d.polygon);
				if( storageInfo != null ) {
					storageInfo.add(d);
				}
			}
		}
		return storage;
	}
1125413
public static double[] bbox(@NonNull Polygon polygon) {
    List<Point> resultCoords = TurfMeta.coordAll(polygon, false);
    return bboxCalculator(resultCoords);
  }
462211
public Polygon copy() {
		float[] copyPoints = new float[points.length];
		System.arraycopy(points, 0, copyPoints, 0, copyPoints.length);
		
		return new Polygon(copyPoints);
	}
1121210
@Override
	@Pure
	protected Rectangle2d calcBounds() {
		if (getPointCount() == 0) {
			return null;
		}

		final Iterator<Point2d> iterPoints = points().iterator();
		if (!iterPoints.hasNext()) {
			return null;
		}

		Point2d point = iterPoints.next();
		if (point == null) {
			return null;
		}

		double minx = point.getX();
		double maxx = point.getX();
		double miny = point.getY();
		double maxy = point.getY();

		while (iterPoints.hasNext()) {
			point = iterPoints.next();
			if (point != null) {
				final double x = point.getX();
				final double y = point.getY();
				if (x < minx) {
					minx = x;
				}
				if (y < miny) {
					miny = y;
				}
				if (x > maxx) {
					maxx = x;
				}
				if (y > maxy) {
					maxy = y;
				}
			}
		}
		final Rectangle2d r = new Rectangle2d();
		r.setFromCorners(minx, miny, maxx, maxy);
		return r;
	}
126833
@Pure
	public Rectangle2d getCellBounds(int row, int column) {
		final double cellWidth = getCellWidth();
		final double cellHeight = getCellHeight();
		final double x = this.bounds.getMinX() + cellWidth * column;
		final double y = this.bounds.getMinY() + cellHeight * row;
		return new Rectangle2d(x, y, cellWidth, cellHeight);
	}
961655
function() {
        const bounds = this._pixelBounds();
        const pixelSize = (bounds.max.x - bounds.min.x) / this._field.nCols;

        var stride = Math.max(
            1,
            Math.floor(1.2 * this.options.vectorSize / pixelSize)
        );

        const ctx = this._getDrawingContext();
        ctx.strokeStyle = this.options.color;

        var currentBounds = this._map.getBounds();

        for (var y = 0; y < this._field.height; y = y + stride) {
            for (var x = 0; x < this._field.width; x = x + stride) {
                let [lon, lat] = this._field._lonLatAtIndexes(x, y);
                let v = this._field.valueAt(lon, lat);
                let center = L.latLng(lat, lon);
                if (v !== null && currentBounds.contains(center)) {
                    let cell = new Cell(
                        center,
                        v,
                        this.cellXSize,
                        this.cellYSize
                    );
                    this._drawArrow(cell, ctx);
                }
            }
        }
    }
487044
public Rectangle2D.Double getRectangle() {
        return new Rectangle2D.Double(west, south, east - west, north - south);
    }
138043
private void calcOffsets()
    {
        //Find the longest line
        int rowidx[] = new int[rows.size()];
        int maxCells = 0;
        for (int r = 0; r < rows.size(); r++)
        {
            int count = rows.elementAt(r).getCellCount();
            if (count > maxCells) maxCells = count;
            rowidx[r] = 0;
            rows.elementAt(r).rewind();
        }
        
        //determine the cell positions
        int col = 0;
        boolean cell_found = true;
        while (cell_found)
        {
            cell_found = false;
            int r = 0;
            while (r < rows.size())
            {
                TableRowBox row = rows.elementAt(r);
                if (row.hasNext())
                {
                    cell_found = true;
                    if (rowidx[r] <= col) //we are not in the middle of some colspan for this row
                    {
                        //get the current element
                        TableCellBox cell = row.next();
                        //set the new position
                        cell.setCellPosition(rowidx[r], r);
                        //move the row indices
                        for (int nr = r; nr < r + cell.getRowspan(); nr++)
                        {
                            if (nr < rows.size())
                            {
                                rowidx[nr] += cell.getColspan();
                                if (rowidx[nr] > numCols) numCols = rowidx[nr]; 
                            }
                            else
                                cell.rowspan--;
                        }
                        r += cell.getRowspan();
                    }
                    else
                        r++;
                }
                else
                    r++;
            }
            col++;
        }    
        //build the cell array
        for (int i = 0; i < rows.size(); i++)
            rows.elementAt(i).rewind();
        cells = new TableCellBox[numCols][rows.size()];
        for (int c = 0; c < maxCells; c++)
        {
            for (int r = 0; r < rows.size(); r++)
            {
                TableRowBox row = rows.elementAt(r);
                if (row.hasNext())
                {
                    TableCellBox cell = row.next();
                    if (cell.getRow() + cell.getRowspan() > rows.size())
                        cell.setRowspan(rows.size() - cell.getRow());
                    if (cell.getColumn() + cell.getColspan() > numCols)
                        cell.setColspan(numCols - cell.getColumn());
                    
                    int endrow = cell.getRow() + cell.getRowspan();
                    int endcol = cell.getColumn() + cell.getColspan();
                    //add it to the mesh
                    for (int nr = cell.getRow(); nr < endrow; nr++)
                        for (int nc = cell.getColumn(); nc < endcol; nc++)
                            cells[nc][nr] = cell;
                }
            }
        }
    }
312955
@Pure
	public Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) {
		return getGridCellsOn(bounds, false);
	}
280789
public Vector getOIDs()
    {
        Vector v = new Vector();

        for (int i = 0; i != ordering.size(); i++)
        {
            v.addElement(ordering.elementAt(i));
        }

        return v;
    }
1030837
function Polygon( sides, x, y, tileSize, ctx, num, analyser, streamData, tiles, fgRotation ){
	this.analyser = analyser;
	this.sides = sides;
	this.tileSize = tileSize;
	this.ctx = ctx;
	this.tiles = tiles;
	this.fgRotation = fgRotation;

	/*
		The number of the tile, starting at 0
	*/
	this.num = num;
	/*
		The highest colour value, which then fades out
	*/
	this.high = 0;
	/*
		Increase this value to fade out faster.
	*/
	this.decay = this.num > 42 ? 1.5 : 2;
	/* For highlighted stroke effect
		figure out the x and y coordinates of the center of the polygon based on the
		60 degree XY axis coordinates passed in
	*/
	this.highlight = 0;

	var step = Math.round(Math.cos(Math.PI/6)*tileSize*2);
	this.y = Math.round(step * Math.sin(Math.PI/3) * -y  );
	this.x = Math.round(x * step + y * step/2 );

	/*
		Calculate the vertices of the polygon
	*/
	this.vertices = [];
	for (var i = 1; i <= this.sides;i += 1) {

		x = this.x + this.tileSize * Math.cos(i * 2 * Math.PI / this.sides + Math.PI/6);
		y = this.y + this.tileSize * Math.sin(i * 2 * Math.PI / this.sides + Math.PI/6);

		this.vertices.push([x, y]);
	}

	this.streamData = streamData;
}
255794
function polygon( $p, $np, $f = 0 )
    {
        $this->objects[$this->currentContents]['c'].= "\n";
        $this->objects[$this->currentContents]['c'].= sprintf('%.3F',$p[0]).' '.sprintf('%.3F',$p[1]).' m ';
        for ( $i = 2; $i < $np*2; $i = $i + 2 )
        {
            $this->objects[$this->currentContents]['c'].= sprintf('%.3F',$p[$i]).' '.sprintf('%.3F',$p[$i+1]).' l ';
        }
        if ( $f == 1 )
        {
            $this->objects[$this->currentContents]['c'].= ' f';
        }
        else
        {
            $this->objects[$this->currentContents]['c'].= ' S';
        }
    }
1362756
public static Polygon getRegionPolygon( GridCoverage2D gridCoverage ) {
        Envelope2D env = gridCoverage.getEnvelope2D();
        Coordinate[] c = new Coordinate[]{new Coordinate(env.getMinX(), env.getMinY()),
                new Coordinate(env.getMinX(), env.getMaxY()), new Coordinate(env.getMaxX(), env.getMaxY()),
                new Coordinate(env.getMaxX(), env.getMinY()), new Coordinate(env.getMinX(), env.getMinY())};
        GeometryFactory gf = GeometryUtilities.gf();
        LinearRing linearRing = gf.createLinearRing(c);
        Polygon polygon = gf.createPolygon(linearRing, null);
        return polygon;
    }