http://www.graphviz.org/doc/info/shapes.html#polygon
433665
def add_child(graph, child_id, child_label, parent_id, colour):
    
    node = pydot.Node(child_id, style="filled", fillcolor=colour, label=child_label, shape="polygon", fontname=FONT)
    graph.add_node(node)
    graph.add_edge(pydot.Edge(parent_id, node))
1255609
def draw_polygon(
            self,
            *pts,
            close_path=True,
            stroke=None,
            stroke_width=1,
            stroke_dash=None,
            fill=None
            ) -> None:
        """"""
        c = self.c
        c.save()
        c.new_path()
        for x,y in zip(*[iter(pts)]*2):
            c.line_to(x, y)
        if close_path:
            c.close_path()
        self._fill_and_stroke(stroke, stroke_width, stroke_dash, fill)
        c.restore()
1223645
def shapes(self):
        
        from pptx.shapes.shapetree import GroupShapes
        return GroupShapes(self._element, self)
411841
function (x, y, r) {
    return new BVG('polygon', x.constructor.name === 'Object' ? x : {
      x: x,
      y: y,
      r: r
    }, function (tag, data) {
      var points = [
        [data.x, data.y-data.r],
        [data.x-data.r/2*Math.sqrt(3), data.y+data.r/2],
        [data.x+data.r/2*Math.sqrt(3), data.y+data.r/2]
      ];
      tag.setAttribute('points', points.join(' '));
    });
  }
726605
function convertShape (shape, tag) {
  return templates.element({
    'tag': tag,
    'width': shape.width,
    'height': shape.height,
    'fill': shape.properties.fill
  });
}
813660
def draw_polygon(coords = [], attr = {})
            load!

            stroke_color  = attr.fetch(:stroke_color, DEFAULT_STROKE_COLOR)
            fill_color    = attr.fetch(:fill_color, DEFAULT_FILL_COLOR)
            line_cap      = attr.fetch(:line_cap, DEFAULT_LINECAP)
            line_join     = attr.fetch(:line_join, DEFAULT_LINEJOIN)
            line_width    = attr.fetch(:line_width, DEFAULT_LINEWIDTH)
            dash_pattern  = attr.fetch(:dash, DEFAULT_DASHPATTERN)

            stroke        = attr[:stroke].nil? ? true : attr[:stroke]
            fill          = attr[:fill].nil? ? false : attr[:fill]

            stroke = true if fill == false and stroke == false

            set_fill_color(fill_color) if fill
            set_stroke_color(stroke_color) if stroke
            set_line_width(line_width)
            set_line_cap(line_cap)
            set_line_join(line_join)
            set_dash_pattern(dash_pattern)

            if @canvas.gs.text_state.is_in_text_object?
                @instructions << PDF::Instruction.new('ET').render(@canvas)
            end

            unless coords.size < 1
                x,y = coords.slice!(0)
                @instructions << PDF::Instruction.new('m',x,y).render(@canvas)

                coords.each do |px,py|
                    @instructions << PDF::Instruction.new('l',px,py).render(@canvas)
                end

                @instructions << (i =
                    if stroke and not fill
                        PDF::Instruction.new('s')
                    elsif fill and not stroke
                        PDF::Instruction.new('f')
                    elsif fill and stroke
                        PDF::Instruction.new('b')
                    end
                )

                i.render(@canvas)
            end

            self
        end
391089
function(polygon) {
            var result = {
                type: null,
                front: null,
                back: null
            };
            // cache in local vars (speedup):
            var planenormal = this.normal;
            var vertices = polygon.vertices;
            var numvertices = vertices.length;
            if (polygon.plane.equals(this)) {
                result.type = 0;
            } else {
                var EPS = CSG.Plane.EPSILON;
                var thisw = this.w;
                var hasfront = false;
                var hasback = false;
                var vertexIsBack = [];
                var MINEPS = -EPS;
                for (var i = 0; i < numvertices; i++) {
                    var t = planenormal.dot(vertices[i].pos) - thisw;
                    var isback = (t < 0);
                    vertexIsBack.push(isback);
                    if (t > EPS) hasfront = true;
                    if (t < MINEPS) hasback = true;
                }
                if ((!hasfront) && (!hasback)) {
                    // all points coplanar
                    var t = planenormal.dot(polygon.plane.normal);
                    result.type = (t >= 0) ? 0 : 1;
                } else if (!hasback) {
                    result.type = 2;
                } else if (!hasfront) {
                    result.type = 3;
                } else {
                    // spanning
                    result.type = 4;
                    var frontvertices = [],
                        backvertices = [];
                    var isback = vertexIsBack[0];
                    for (var vertexindex = 0; vertexindex < numvertices; vertexindex++) {
                        var vertex = vertices[vertexindex];
                        var nextvertexindex = vertexindex + 1;
                        if (nextvertexindex >= numvertices) nextvertexindex = 0;
                        var nextisback = vertexIsBack[nextvertexindex];
                        if (isback == nextisback) {
                            // line segment is on one side of the plane:
                            if (isback) {
                                backvertices.push(vertex);
                            } else {
                                frontvertices.push(vertex);
                            }
                        } else {
                            // line segment intersects plane:
                            var point = vertex.pos;
                            var nextpoint = vertices[nextvertexindex].pos;
                            var intersectionpoint = this.splitLineBetweenPoints(point, nextpoint);
                            var intersectionvertex = new CSG.Vertex(intersectionpoint);
                            if (isback) {
                                backvertices.push(vertex);
                                backvertices.push(intersectionvertex);
                                frontvertices.push(intersectionvertex);
                            } else {
                                frontvertices.push(vertex);
                                frontvertices.push(intersectionvertex);
                                backvertices.push(intersectionvertex);
                            }
                        }
                        isback = nextisback;
                    } // for vertexindex
                    // remove duplicate vertices:
                    var EPS_SQUARED = CSG.Plane.EPSILON * CSG.Plane.EPSILON;
                    if (backvertices.length >= 3) {
                        var prevvertex = backvertices[backvertices.length - 1];
                        for (var vertexindex = 0; vertexindex < backvertices.length; vertexindex++) {
                            var vertex = backvertices[vertexindex];
                            if (vertex.pos.distanceToSquared(prevvertex.pos) < EPS_SQUARED) {
                                backvertices.splice(vertexindex, 1);
                                vertexindex--;
                            }
                            prevvertex = vertex;
                        }
                    }
                    if (frontvertices.length >= 3) {
                        var prevvertex = frontvertices[frontvertices.length - 1];
                        for (var vertexindex = 0; vertexindex < frontvertices.length; vertexindex++) {
                            var vertex = frontvertices[vertexindex];
                            if (vertex.pos.distanceToSquared(prevvertex.pos) < EPS_SQUARED) {
                                frontvertices.splice(vertexindex, 1);
                                vertexindex--;
                            }
                            prevvertex = vertex;
                        }
                    }
                    if (frontvertices.length >= 3) {
                        result.front = new CSG.Polygon(frontvertices, polygon.shared, polygon.plane);
                    }
                    if (backvertices.length >= 3) {
                        result.back = new CSG.Polygon(backvertices, polygon.shared, polygon.plane);
                    }
                }
            }
            return result;
        }
872343
def polygon_list(self):
        ''''''
        done = set()
        ret = []
        while len(done) != self.count():
            p = self.polygon(done)
            if len(p) > 0:
                ret.append(p)
        return ret
211593
def polygon(self):
            ''''''
            points = []
            for fp in self.points[1:]:
                    points.append((fp.lat, fp.lng))
            return points
116989
def bounding_polygon(self):
        
        lon_left, lat_bottom, lon_right, lat_top = Tile.tile_coords_to_bbox(self.x, self.y, self.zoom)
        print(lon_left, lat_bottom, lon_right, lat_top)
        return Polygon([[[lon_left, lat_top],
                       [lon_right, lat_top],
                       [lon_right, lat_bottom],
                       [lon_left, lat_bottom],
                       [lon_left, lat_top]]])
180462
function (options) {
  options = options || {}
  if (('points' in options) !== ('faces' in options)) {
    throw new Error("polyhedron needs 'points' and 'faces' arrays")
  }
  let vertices = parseOptionAs3DVectorList(options, 'points', [
            [1, 1, 0],
            [1, -1, 0],
            [-1, -1, 0],
            [-1, 1, 0],
            [0, 0, 1]
  ])
        .map(function (pt) {
          return new Vertex3(pt)
        })
  let faces = parseOption(options, 'faces', [
            [0, 1, 4],
            [1, 2, 4],
            [2, 3, 4],
            [3, 0, 4],
            [1, 0, 3],
            [2, 1, 3]
  ])
    // Openscad convention defines inward normals - so we have to invert here
  faces.forEach(function (face) {
    face.reverse()
  })
  let polygons = faces.map(function (face) {
    return new Polygon3(face.map(function (idx) {
      return vertices[idx]
    }))
  })

    // TODO: facecenters as connectors? probably overkill. Maybe centroid
    // the re-tesselation here happens because it's so easy for a user to
    // create parametrized polyhedrons that end up with 1-2 dimensional polygons.
    // These will create infinite loops at CSG.Tree()
  return fromPolygons(polygons).reTesselated()
}
456189
def polygon_diameter(points):
    ''' 
    '''
    return max(point_dist(p0, p1) for (p0, p1) in combinations(points, 2))
926169
function fillPolygon(poly) {
         var points = poly.points;
         var glPoints = this._glPoints;
         var indices = poly.getIndices();
         var x = poly.pos.x,
             y = poly.pos.y; // Grow internal points buffer if necessary

         for (i = glPoints.length; i < indices.length; i++) {
           glPoints.push(new me.Vector2d());
         } // calculate all vertices


         for (var i = 0; i < indices.length; i++) {
           glPoints[i].set(x + points[indices[i]].x, y + points[indices[i]].y);
         } // draw all triangle


         this.compositor.drawTriangle(glPoints, indices.length);
       }
788751
private boolean drawPolygon(FeatureTileGraphics graphics, Area polygon,
			FeatureStyle featureStyle) {

		Graphics2D polygonGraphics = graphics.getPolygonGraphics();

		Paint fillPaint = getPolygonFillPaint(featureStyle);
		if (fillPaint != null) {

			polygonGraphics.setColor(fillPaint.getColor());
			polygonGraphics.fill(polygon);

		}

		Paint paint = getPolygonPaint(featureStyle);
		polygonGraphics.setColor(paint.getColor());
		polygonGraphics.setStroke(paint.getStroke());

		boolean drawn = polygonGraphics.hit(new java.awt.Rectangle(tileWidth,
				tileHeight), polygon, true);
		if (drawn) {
			polygonGraphics.draw(polygon);
		}

		return drawn;
	}
414762
def _get_geometry(self):
        
        return shapely.geometry.MultiPolygon([bbox.geometry for bbox in self.bbox_list])
1051414
function polygon($points, $color, $width = null, $style = null, $fill = false) {

    $this->_set_fill_color($color);
    $this->_set_stroke_color($color);

    if ( !$fill && isset($width) )
      $this->_set_line_style($width, "square", "miter", $style);

    $y = $this->y(array_pop($points));
    $x = array_pop($points);
    $this->_pdf->moveto($x,$y);

    while (count($points) > 1) {
      $y = $this->y(array_pop($points));
      $x = array_pop($points);
      $this->_pdf->lineto($x,$y);
    }

    if ( $fill )
      $this->_pdf->fill();
    else
      $this->_pdf->closepath_stroke();
  }
280347
function ( radius, detail ) {

	var t = ( 1 + Math.sqrt( 5 ) ) / 2;

	var vertices = [
		- 1, t, 0, 	1, t, 0, 	- 1, - t, 0, 	1, - t, 0,
		 0, - 1, t, 	0, 1, t,	0, - 1, - t, 	0, 1, - t,
		 t, 0, - 1, 	t, 0, 1, 	- t, 0, - 1, 	- t, 0, 1
	];

	var indices = [
		 0, 11, 5, 	0, 5, 1, 	0, 1, 7, 	0, 7, 10, 	0, 10, 11,
		 1, 5, 9, 	5, 11, 4,	11, 10, 2,	10, 7, 6,	7, 1, 8,
		 3, 9, 4, 	3, 4, 2,	3, 2, 6,	3, 6, 8,	3, 8, 9,
		 4, 9, 5, 	2, 4, 11,	6, 2, 10,	8, 6, 7,	9, 8, 1
	];

	PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );

	this.type = '';

	this.parameters = {
		radius: radius,
		detail: detail
	};

}