Draw one of the natural neighbor polygons with some information.
484922
def draw_polygon_with_info(ax, polygon, off_x=0, off_y=0):
    """"""
    pts = np.array(polygon)[ConvexHull(polygon).vertices]
    for i, pt in enumerate(pts):
        ax.plot([pt[0], pts[(i + 1) % len(pts)][0]],
                [pt[1], pts[(i + 1) % len(pts)][1]], 'k-')

    avex, avey = np.mean(pts, axis=0)
    ax.annotate('area: {:.3f}'.format(geometry.area(pts)), xy=(avex + off_x, avey + off_y),
                fontsize=12)
1036206
function (otherCsg, csg) {
  if ((otherCsg.polygons.length === 0) || (csg.polygons.length === 0)) {
    return false
  } else {
    let mybounds = bounds(otherCsg)
    let otherbounds = bounds(csg)
    if (mybounds[1].x < otherbounds[0].x) return false
    if (mybounds[0].x > otherbounds[1].x) return false
    if (mybounds[1].y < otherbounds[0].y) return false
    if (mybounds[0].y > otherbounds[1].y) return false
    if (mybounds[1].z < otherbounds[0].z) return false
    if (mybounds[0].z > otherbounds[1].z) return false
    return true
  }
}
63608
def clip_polygon(self, points):
        """"""
        self.gsave()
        self._path_polygon(points)
        self.__clip_stack.append(self.__clip_box)
        self.__clip_box = _intersect_box(self.__clip_box, _compute_bounding_box(points))
        self.clip_sub()
1317372
function Polygon(options) {

    var self = this;
    this.manager = options.manager;
    this.paper = options.paper;

    if (options.id) {
        this._id = options.id;
    } else {
        this._id = this.manager.getRandomId();
    }
    this._points = options.points;

    this._strokeColor = options.strokeColor;
    this._strokeWidth = options.strokeWidth || 2;
    this._selected = false;
    this._zoomFraction = 1;
    if (options.zoom) {
        this._zoomFraction = options.zoom / 100;
    }
    this.handle_wh = 6;

    this.element = this.paper.path("");
    this.element.attr({'fill-opacity': 0.01,
                        'fill': '#fff',
                        'cursor': 'pointer'});

    if (this.manager.canEdit) {
        // Drag handling of element
        this.element.drag(
            function(dx, dy) {
                if (self._zoomFraction === 0) {
                    return;     // just in case
                }
                // DRAG, update location and redraw
                dx = dx / self._zoomFraction;
                dy = dy / self._zoomFraction;

                var offsetX = dx - this.prevX;
                var offsetY = dy - this.prevY;
                this.prevX = dx;
                this.prevY = dy;

                // Manager handles move and redraw
                self.manager.moveSelectedShapes(offsetX, offsetY, true);
            },
            function() {
                self._handleMousedown();
                this.prevX = 0;
                this.prevY = 0;
                return false;
            },
            function() {
                // STOP
                // notify manager if rectangle has moved
                if (this.prevX !== 0 || this.prevY !== 0) {
                    self.manager.notifySelectedShapesChanged();
                }
                return false;
            }
        );
    }

    // create handles...
    this.createHandles();
    // and draw the Polygon
    this.drawShape();
}
563833
def draw_objects(self, objects, bounds, img):
        ''''''
        keys = sorted(objects.keys())
        for k in keys:
            obj = objects[k]
            if not self.state.legend and isinstance(obj, SlipFlightModeLegend):
                continue
            bounds2 = obj.bounds()
            if bounds2 is None or mp_util.bounds_overlap(bounds, bounds2):
                obj.draw(img, self.pixmapper, bounds)
563794
def create_regpoly(self, x0, y0, x1, y1, sides=0, start=90, extent=360, **kw):
        """"""
        coords = self.__regpoly_coords(x0, y0, x1, y1, sides, start, extent)
        return self.canvas.create_polygon(*coords, **kw)
527176
public void drawPolygon(Object parent, String name, Polygon polygon, ShapeStyle style) {
		if (isAttached()) {
			Element element = helper.createOrUpdateElement(parent, name, "shape", style);
			if (polygon != null) {
				Dom.setStyleAttribute(element, "position", "absolute");
				Dom.setElementAttribute(element, "fill-rule", "evenodd");
				Dom.setElementAttribute(element, "path", VmlPathDecoder.decode(polygon));
				applyElementSize(element, getWidth(), getHeight(), false);
			}
		}
	}
1059920
function polygonDecomp(polygon){
    var edges = polygonGetCutEdges(polygon);
    if(edges.length > 0){
        return polygonSlice(polygon, edges);
    } else {
        return [polygon];
    }
}
1176524
def draw_polygon(
            self,
            *pts,
            close_path:bool=True,
            stroke:Color=None,
            stroke_width:float=1,
            stroke_dash:typing.Sequence=None,
            fill:Color=None
            ) -> None:
        """"""
        pass
1328034
def neighbors((x, y)):
    """"""
    yield x + 1, y
    yield x - 1, y
    yield x, y + 1
    yield x, y - 1
    yield x + 1, y + 1
    yield x + 1, y - 1
    yield x - 1, y + 1
    yield x - 1, y - 1
140796
public void markNeighborEdges()
    {
        for( int i = 0; i < 3; i++ )
        {
            if( cEdge[i] )
            {
                switch( i )
                {
                    case 0:
                        if( neighbors[0] != null )
                            neighbors[0].markConstrainedEdge( points[1], points[2] );
                        break;
                    case 1:
                        if( neighbors[1] != null )
                            neighbors[1].markConstrainedEdge( points[0], points[2] );
                        break;
                    case 2:
                        if( neighbors[2] != null )
                            neighbors[2].markConstrainedEdge( points[0], points[1] );
                        break;
                }
            }
        }
    }
291174
def draw(self):
        """"""
        str_wires = [["-"]*7 * self.depth]
        str_wires[0][0] = "0"
        str_wires[0][1] = " o"
        str_spaces = []

        for i in range(1, self.dimension):
            str_wires.append(["-"]*7 * self.depth)
            str_spaces.append([" "]*7 * self.depth)
            str_wires[i][0] = str(i)
            str_wires[i][1] = " o"
        
        for index, level in enumerate(self):
            for wire1, wire2 in level:
                str_wires[wire1][(index+1)*6] = "x"
                str_wires[wire2][(index+1)*6] = "x"
                for i in range(wire1, wire2):
                    str_spaces[i][(index+1)*6+1] = "|"
                for i in range(wire1+1, wire2):
                    str_wires[i][(index+1)*6] = "|"
        
        network_draw = "".join(str_wires[0])
        for line, space in zip(str_wires[1:], str_spaces):
            network_draw += "\n"
            network_draw += "".join(space)
            network_draw += "\n"
            network_draw += "".join(line)
        return network_draw
995877
@SuppressWarnings("unused")
	private void drawAnomalies() {
		PEAnomalyScanner scanner = PEAnomalyScanner.newInstance(data);
		List<Anomaly> anomalies = scanner.getAnomalies();
		for (Anomaly anomaly : anomalies) {
			List<PhysicalLocation> locs = anomaly.locations();
			for (PhysicalLocation loc : locs) {
				drawCrosses(colorMap.get(ANOMALY), loc.from(),
						withMinLength(loc.size()));
			}
		}
	}
238983
private void DrawPrimitive( DrawCuboid c, World w ) throws Exception
    {
        XMLBlockState blockType = new XMLBlockState(c.getType(), c.getColour(), c.getFace(), c.getVariant());
        if (!blockType.isValid())
            throw new Exception("Unrecogised item type: "+c.getType().value());

        int x1 = Math.min(c.getX1(), c.getX2());
        int x2 = Math.max(c.getX1(), c.getX2());
        int y1 = Math.min(c.getY1(), c.getY2());
        int y2 = Math.max(c.getY1(), c.getY2());
        int z1 = Math.min(c.getZ1(), c.getZ2());
        int z2 = Math.max(c.getZ1(), c.getZ2());

        clearEntities(w, x1, y1, z1, x2 + 1, y2 + 1, z2 + 1);

        for( int x = x1; x <= x2; x++ ) {
            for( int y = y1; y <= y2; y++ ) {
                for( int z = z1; z <= z2; z++ ) {
                    BlockPos pos = new BlockPos(x, y, z);
                    setBlockState(w, pos, blockType);
                }
            }
        }
    }
1059222
def draw(self, milliseconds, surface):
        """"""
        surface.blit(self.image, self.coords, self.source, special_flags=0)
84322
def bounds(self):
        """"""
        corners = [self.image_corner(corner) for corner in self.corner_types()]
        return Polygon([[corner.x, corner.y] for corner in corners])
750971
def neighbour(lat:0, lng:0)
      new_point = Point.new(
        lat: southwest.lat + dlat(lat),
        lng: southwest.lng + dlng(lng))
      Tile.including(new_point, depth: depth)
    end