Creates the two polygons to show the sky and ground.
493042
def createHorizonPolygons(self):
        ''''''
        # Sky Polygon
        vertsTop = [[-1,0],[-1,1],[1,1],[1,0],[-1,0]]
        self.topPolygon = Polygon(vertsTop,facecolor='dodgerblue',edgecolor='none')
        self.axes.add_patch(self.topPolygon)
        # Ground Polygon
        vertsBot = [[-1,0],[-1,-1],[1,-1],[1,0],[-1,0]]
        self.botPolygon = Polygon(vertsBot,facecolor='brown',edgecolor='none')
        self.axes.add_patch(self.botPolygon)
491809
function() {
        this.angle = Math.PI * ((1/this.sides) - (1/2));
        if(this.snapAngle) {
            this.angle += this.snapAngle * (Math.PI / 180);
        }
        this.feature.geometry = OpenLayers.Geometry.Polygon.createRegularPolygon(
            this.origin, this.radius, this.sides, this.snapAngle
        );
    }
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;
    }
1067599
function() {
    var dir = game.player.dir;
    var sky = game.map.skybox;
    var ambient = game.map.light;
    var width = sky.width * (this.height / sky.height) * 2;
    var left = (dir / circle) * -width;

    ctx.save();
    ctx.drawImage(sky.image, left, 0, width, this.height);
    if (left < width - this.width) {
      ctx.drawImage(sky.image, left + width, 0, width, this.height);
    }
    if (ambient > 0) {
      ctx.fillStyle = '#fff';
      ctx.globalAlpha = ambient * 0.1;
      ctx.fillRect(0, this.height * 0.5, this.width, this.height * 0.5);
    }
    ctx.restore();
  }
853651
private Overlay createPolygon(BoundingBox key, Integer value, int redthreshold, int orangethreshold) {
        Polygon polygon = new Polygon(mMapView);
        if (value < orangethreshold)
            polygon.setFillColor(Color.parseColor(alpha + yellow));
        else if (value < redthreshold)
            polygon.setFillColor(Color.parseColor(alpha + orange));
        else if (value >= redthreshold)
            polygon.setFillColor(Color.parseColor(alpha + red));
        else {
            //no polygon
        }
        polygon.setStrokeColor(polygon.getFillColor());

        //if you set this to something like 20f and have a low alpha setting,
        // you'll end with a gaussian blur like effect
        polygon.setStrokeWidth(0f);
        List<GeoPoint> pts = new ArrayList<GeoPoint>();
        pts.add(new GeoPoint(key.getLatNorth(), key.getLonWest()));
        pts.add(new GeoPoint(key.getLatNorth(), key.getLonEast()));
        pts.add(new GeoPoint(key.getLatSouth(), key.getLonEast()));
        pts.add(new GeoPoint(key.getLatSouth(), key.getLonWest()));
        polygon.setPoints(pts);
        return polygon;
    }
158185
public static Polygon createPolygonFromBounds( double minX, double minY, double maxX, double maxY ) {
        Coordinate[] c = new Coordinate[]{new Coordinate(minX, minY), new Coordinate(minX, maxY), new Coordinate(maxX, maxY),
                new Coordinate(maxX, minY), new Coordinate(minX, minY)};
        return gf().createPolygon(c);
    }
878640
def polygon(self, points, stroke=None, fill=None, stroke_width=1, disable_anti_aliasing=False):
        
        self.put(' <polygon points="')
        self.put(' '.join(['%s,%s' % p for p in points]))
        self.put('" stroke-width="')
        self.put(str(stroke_width))
        self.put('"')
        if fill:
            self.put(' fill="')
            self.put(fill)
            self.put('"')
        if stroke:
            self.put(' stroke="')
            self.put(stroke)
            self.put('"')
        if disable_anti_aliasing:
            self.put(' shape-rendering="crispEdges"')
        self.put('/>\n')
454449
def polygon(surf, points, color):
    """"""

    gfxdraw.aapolygon(surf, points, color)
    gfxdraw.filled_polygon(surf, points, color)

    x = min([x for (x, y) in points])
    y = min([y for (x, y) in points])
    xm = max([x for (x, y) in points])
    ym = max([y for (x, y) in points])

    return pygame.Rect(x, y, xm - x, ym - y)
556018
function(plane) {
            if (this.polygons.length === 0) {
                return new CSG();
            }
            // Ideally we would like to do an intersection with a polygon of inifinite size
            // but this is not supported by our implementation. As a workaround, we will create
            // a cube, with one face on the plane, and a size larger enough so that the entire
            // solid fits in the cube.
            // find the max distance of any vertex to the center of the plane:
            var planecenter = plane.normal.times(plane.w);
            var maxdistance = 0;
            this.polygons.map(function(polygon) {
                polygon.vertices.map(function(vertex) {
                    var distance = vertex.pos.distanceToSquared(planecenter);
                    if (distance > maxdistance) maxdistance = distance;
                });
            });
            maxdistance = Math.sqrt(maxdistance);
            maxdistance *= 1.01; // make sure it's really larger
            // Now build a polygon on the plane, at any point farther than maxdistance from the plane center:
            var vertices = [];
            var orthobasis = new CSG.OrthoNormalBasis(plane);
            vertices.push(new CSG.Vertex(orthobasis.to3D(new CSG.Vector2D(maxdistance, -maxdistance))));
            vertices.push(new CSG.Vertex(orthobasis.to3D(new CSG.Vector2D(-maxdistance, -maxdistance))));
            vertices.push(new CSG.Vertex(orthobasis.to3D(new CSG.Vector2D(-maxdistance, maxdistance))));
            vertices.push(new CSG.Vertex(orthobasis.to3D(new CSG.Vector2D(maxdistance, maxdistance))));
            var polygon = new CSG.Polygon(vertices, null, plane.flipped());

            // and extrude the polygon into a cube, backwards of the plane:
            var cube = polygon.extrude(plane.normal.times(-maxdistance));

            // Now we can do the intersection:
            var result = this.intersect(cube);
            result.properties = this.properties; // keep original properties
            return result;
        }
558645
function (polygon, x1, y1, x2, y2) {
		var nn = polygon.length;
		var width12 = x1 - x2, height12 = y1 - y2;
		var det1 = x1 * y2 - y1 * x2;
		var x3 = polygon[nn - 2], y3 = polygon[nn - 1];
		for (var ii = 0; ii < nn; ii += 2) {
			var x4 = polygon[ii], y4 = polygon[ii + 1];
			var det2 = x3 * y4 - y3 * x4;
			var width34 = x3 - x4, height34 = y3 - y4;
			var det3 = width12 * height34 - height12 * width34;
			var x = (det1 * width34 - width12 * det2) / det3;
			if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {
				var y = (det1 * height34 - height12 * det2) / det3;
				if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return true;
			}
			x3 = x4;
			y3 = y4;
		}
		return false;
	}
1106720
public void setSphereGlobe() {
        Earth globe = new Earth();
        wwd.getModel().setGlobe(globe);
        wwd.getView().stopMovement();
        wwd.redraw();
    }
1020329
public Polygon toPolygon(List<LatLng> latLngs, List<List<LatLng>> holes) {
        return toPolygon(latLngs, holes, false, false);
    }
129467
public static Geometry drapeMultiPolygon(MultiPolygon polygons, Geometry triangles, STRtree sTRtree) {
        GeometryFactory factory = polygons.getFactory();         
        //Split the triangles in lines to perform all intersections
        Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
        int nbPolygons = polygons.getNumGeometries();
        Polygon[] polygonsDiff = new Polygon[nbPolygons];
        for (int i = 0; i < nbPolygons; i++) {
            polygonsDiff[i] = processPolygon((Polygon) polygons.getGeometryN(i), triangleLines, factory);
        }
        Geometry diffExt = factory.createMultiPolygon(polygonsDiff);
        CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
        diffExt.apply(drapeFilter);
        return diffExt;
    }
345654
function ( width, height, widthSegments, heightSegments ) {

	BufferGeometry.call( this );

	this.type = '';

	this.parameters = {
		width: width,
		height: height,
		widthSegments: widthSegments,
		heightSegments: heightSegments
	};

	width = width || 1;
	height = height || 1;

	var width_half = width / 2;
	var height_half = height / 2;

	var gridX = Math.floor( widthSegments ) || 1;
	var gridY = Math.floor( heightSegments ) || 1;

	var gridX1 = gridX + 1;
	var gridY1 = gridY + 1;

	var segment_width = width / gridX;
	var segment_height = height / gridY;

	var ix, iy;

	// buffers

	var indices = [];
	var vertices = [];
	var normals = [];
	var uvs = [];

	// generate vertices, normals and uvs

	for ( iy = 0; iy < gridY1; iy ++ ) {

		var y = iy * segment_height - height_half;

		for ( ix = 0; ix < gridX1; ix ++ ) {

			var x = ix * segment_width - width_half;

			vertices.push( x, - y, 0 );

			normals.push( 0, 0, 1 );

			uvs.push( ix / gridX );
			uvs.push( 1 - ( iy / gridY ) );

		}

	}

	// indices

	for ( iy = 0; iy < gridY; iy ++ ) {

		for ( ix = 0; ix < gridX; ix ++ ) {

			var a = ix + gridX1 * iy;
			var b = ix + gridX1 * ( iy + 1 );
			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
			var d = ( ix + 1 ) + gridX1 * iy;

			// faces

			indices.push( a, b, d );
			indices.push( b, c, d );

		}

	}

	// build geometry

	this.setIndex( indices );
	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );

}
665894
public static Polygon create(org.locationtech.jts.geom.Polygon polygon) {
        double[] lats = new double[polygon.getNumPoints()];
        double[] lons = new double[polygon.getNumPoints()];
        for (int i = 0; i < polygon.getNumPoints(); i++) {
            lats[i] = polygon.getCoordinates()[i].y;
            lons[i] = polygon.getCoordinates()[i].x;
        }
        return new Polygon(lats, lons);
    }
130778
function(x1, y1, x2, y2, width, height, centerX, centerY, padding) {
      var points = nodeShapes['square'].points;
      
      /*
      return renderer.boxIntersectPolygon(
        x1, y1, x2, y2,
        points, 
      */
    }
95972
def polygon(self, vertexes, attr=0, row=None):
        ''
        self.polylines.append((vertexes + [vertexes[0]], attr, row))