polygon

How to change color of particular edge for polygon in python?

泪湿孤枕 提交于 2020-02-06 07:48:13
问题 There is a polygon and I am wondering how can I change color of particular edge of it like figure below. import matplotlib.pyplot as plt import numpy as np ## -----------------------Initialize Geometry----------------------- pixels = 600 my_dpi = 100 coord = [[-150,-200],[300,-200],[300,0],[150,200],[-150,200]] fig = plt.figure(figsize=( pixels/my_dpi, pixels/my_dpi), dpi=my_dpi) plt.axes([0,0,1,1]) rectangle = plt.Rectangle((-300, -300), 600, 600, fc='k') plt.gca().add_patch(rectangle)

How to change color of particular edge for polygon in python?

那年仲夏 提交于 2020-02-06 07:45:38
问题 There is a polygon and I am wondering how can I change color of particular edge of it like figure below. import matplotlib.pyplot as plt import numpy as np ## -----------------------Initialize Geometry----------------------- pixels = 600 my_dpi = 100 coord = [[-150,-200],[300,-200],[300,0],[150,200],[-150,200]] fig = plt.figure(figsize=( pixels/my_dpi, pixels/my_dpi), dpi=my_dpi) plt.axes([0,0,1,1]) rectangle = plt.Rectangle((-300, -300), 600, 600, fc='k') plt.gca().add_patch(rectangle)

How to change color of particular edge for polygon in python?

主宰稳场 提交于 2020-02-06 07:45:05
问题 There is a polygon and I am wondering how can I change color of particular edge of it like figure below. import matplotlib.pyplot as plt import numpy as np ## -----------------------Initialize Geometry----------------------- pixels = 600 my_dpi = 100 coord = [[-150,-200],[300,-200],[300,0],[150,200],[-150,200]] fig = plt.figure(figsize=( pixels/my_dpi, pixels/my_dpi), dpi=my_dpi) plt.axes([0,0,1,1]) rectangle = plt.Rectangle((-300, -300), 600, 600, fc='k') plt.gca().add_patch(rectangle)

Adding a Polygon to a SpatialPolygonsDataFrame

天大地大妈咪最大 提交于 2020-02-05 03:58:09
问题 How to add an polygon to a SpatialPolygonsDataFrame? Example: The script underneath will create a SpatialPolygonsDataFrame. I would like to add a polygon which consists of a large square around the existing polygons. library(rgdal) dsn <- system.file("vectors", package = "rgdal")[1] Scotland <- readOGR(dsn=dsn , layer="scot_BNG") plot(Scotland) Preferred end result: It is important that the rectangle becomes part of the SpatialPolygonsDataFrame. Since I have to do some calculation of the

Java LWJGL: When I call “GL11.glEnd” the polygon disappears?

喜你入骨 提交于 2020-01-24 20:33:07
问题 When I call "GL11.glEnd" the polygon disappears. If I leave that one line "GL11.glEnd" out, then it stays on the screen, but when I put it in, the polygon I was drawing disappears. package package01; import org.lwjgl.opengl.GL11; public class Graph { ... void initGraph(){ GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1.0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glOrtho(-500, 500, -281, 281, -1, 1); GL11.glColor3f(0.8f, 0.8f, 1.0f); GL11.glBegin

Remove holes in polygon

浪子不回头ぞ 提交于 2020-01-24 13:44:20
问题 I am trying to solve the following problem in R : I have a polygon object defined by a list l with two components x and y. The order defines the edges of the polygon. For instance : l=list( x=c(-1.93400738955091,0.511747161547164,1.85047596846401,-1.4963460488281,-1.31613255558929,-0.0803828876660542,1.721752044722,-0.724002506376074,-2.08847609804132,2.13366860069641), y=c(-1.02967154136169,1.53216851658359,-1.39564869249673,-1.21266011692921,1.6419616619241,-1.87141898897228,0

Libgdx polygon triangulation

你。 提交于 2020-01-23 08:05:13
问题 Ok, so I have a polygon (simple but concave) that I'm trying to cut into triangles to make it collide with an other polygon. I knew my polygone was concave, so i decided to use LibGDX EarClippingTriangulator to manage to cut it into triangles. So, with this code, I get my triangles vertices : public void triangulate() { Vector<float[]> trianglesVertices = new Vector<float[]>(); ShortArray pointsCoords = new ShortArray(); EarClippingTriangulator triangulator = new EarClippingTriangulator(); //

CSS3 Full Width Trapezoid / Polygon with text?

匆匆过客 提交于 2020-01-17 06:41:09
问题 I'm trying to redo a client site that's currently not responsive and throughout the site she has long images that are trapezoids with text inside. Of course, on devices, you can barely read it. So I'm trying to turn it into CSS using shapes. Tried a bunch of examples but nothing working at the moment. I think the difference is the examples seem to use hard width numbers instead of 100% for fluid width. I have a pen here: https://codepen.io/anon/pen/KmgoqE and here's the code I'm playing with

gCentroid (rgeos) R vs. Actual Centroid (in python)

♀尐吖头ヾ 提交于 2020-01-16 03:37:05
问题 Summary: I thought that using gCentroid in R would return the centroid of a group of points, however I realised that for some reason it actually returns the geometric mean and not the centroid I wanted to replicate a centroid calculation I did in R: gCentroid {rgeos} The centre of mass of these points: 34.7573, -86.678606 38.30088, -76.520266 38.712147, -77.158616 39.704905, -84.126463 ... using the r-script ... require(rgdal) require(rgeos) no_am_eq_co <- "+proj=eqdc +lat_0=0 +lon_0=0 +lat_1

wrong border coords on draw a polygon with the fabric.js

╄→гoц情女王★ 提交于 2020-01-15 09:12:59
问题 i try to draw a polygon with the mouse , and i have found that example on jsfiddle: http://jsfiddle.net/Kienz/ujefxh7w/. the problem is that when we finish the draw and try to selet the object, the borders are outside of the shape. can we fixe that or is it a fabric.js bug? as we can also see on the official fabricjs.com/ page, on the front page examples, the free hand drawings are also out of the border frame. // initialize fabric canvas and assign to global windows object for debug var