polygon

Force chart d3.js inside a triangle

老子叫甜甜 提交于 2019-12-05 02:20:36
问题 I'm studying d3.js force chart and I have a question. Is it possible to make a force chart inside a triangle with some coordinates? Here is my code: var width = 500; var height = 500; //margin var marginLeft = 10; var marginTop = 10; var marginRight = 10; var marginBottom = 10; var margin = { left: marginLeft , top: marginTop, right: marginRight, bottom: marginBottom}; //size of canvas var innerWidth = width - margin.left - margin.right; var innerHeight = height - margin.top - margin.bottom;

How to check if a polygon is empty in Shapely?

烂漫一生 提交于 2019-12-05 02:11:48
I'm pretty new to Python so the answer to this question is probably quite simple, but I've looked everywhere and tried a lot but couldn't find the answer. Simplifying a polygon using Shapely may result in an empty polygon. I want to replace the polygon with a point if the polygon is empty. Something that would work like: if mypoly is empty: mypoly = [(0,0)] Given that mypoly is a shapely polygon, you can check if it's empty using is_empty which is built in to Shapely to check for empty ones. from shapely.geometry import Point if mypoly.is_empty: mypoly = Point(0, 0) 来源: https://stackoverflow

Detect tap on GMSPolyline in Swift?

眉间皱痕 提交于 2019-12-05 01:13:08
I'm struggling with detecting a tap on a GMSPolyline drawn on my Google map, it works just fine with GMSpolygones, but the same approach doesn't seem to work with polyline. My current approach, which works for polygones, is: if (GMSGeometryContainsLocation(coordinate, polygon.path!, false)) { ... } Any suggestions how to detect taps on a polyline? Or just close to it? eshirima According to their API documentation , GMSPolyline inherits from GMSOverlay which means a GMSPolyline has the property tappable . So you'd want something like this let polyLine: GMSPolyline = GMSPolyline(path: newPath)

How to draw polygon using hardcoded values in ngMap using angularjs

时光总嘲笑我的痴心妄想 提交于 2019-12-05 00:58:22
问题 I need to draw polygon on google maps using the hard coded values.I have used ngMap ( https://ngmap.github.io/ )and used drawing manager of ngMap to it, because i also want the user to draw polygon dynamically. if i use drawing manager,i am not able to draw polygon with hardcoded values. and also another thing , if the user put the marker on map. i need to get the co-ordinates of it. (for example:get the co-ordinates in alert box or console). can anyone please help me Plunker here: http:/

How do I minimise the maximum aspect ratio of two subpolygons?

旧时模样 提交于 2019-12-04 23:59:47
问题 I'd like to cut a convex polygon into two with a given ratio of areas using a straight line, such that the larger aspect ratio of the two subpolygons is minimised. My approach at the moment involves choosing a random starting point, computing the appropriate end point that splits the polygon into the target areas, then calculating the larger of the two aspect ratios. Then repeating this lots of times until I'm close enough to a minimum! The aspect ratio of a polygon A is defined as: asp(A) :=

Algorithm for translating list of wallsections into coherent polygon

女生的网名这么多〃 提交于 2019-12-04 22:43:22
I have a list of points that in pairs describe a polygon, like this: <0,0><0,1><0,1><1,0><1,0><1,1><1,1><0,0> which is a square. Note that each pair of points describes a line so our square is made up out of the lines <<0,0><0,1>><<0,1><1,0>><<1,0><1,1>><<1,1><0,0>> I do however have to draw these polygons which works fine when the points in question are all properly in order and there are no holes. Unfortunatly this sometimes goes wrong when the input is like <0,0><0,1><1,1><0,0><0,1><1,0><1,0><1,1> and the resulting polygon is weird or when there are several holes in the <0,0><0,2><0,2><2,0>

Draw a rectangle arround a polygon when given in certain angle

时光总嘲笑我的痴心妄想 提交于 2019-12-04 21:41:04
Using Google Maps V3 API How can I draw a rectangle (It wouldn't exactly be a google map rectangle anymore but a rectangular polygon) around a polygon. Important however is that the rectangle has be rotated around a certain given angle. I do not mean to calculate the min and max of the coord of the polygon first to draw a rectangle and rotate it afterwards; This image may be a better description from what I am trying to accomplish. What I am trying to accomplish is to get the bounding rectangle of the polygon at an angle. This is very similar to finding a bounding box, which is not rotated. If

centerline of a polygonal blob (binary image)

别等时光非礼了梦想. 提交于 2019-12-04 21:00:32
问题 I have a binary image of a worm (blob extraction which works well). I am interested in fitting a centerline on the blowb (worm). So far I came up with this: starting from a polygon (after outline extraction of blob in the image) I applied a voronoi computation and discarded all vertices which are outside of the polygon (blue) which gave me the black center line which I can further use to fit a smooth centerline. However, this computation is not at all robust (due removing voronoi vertices not

Greiner-Hormann clipping with degeneracies

社会主义新天地 提交于 2019-12-04 21:00:19
I'm trying to understand the paper "Clipping of Arbitrary Polygons with Degeneracies" by E. L Foster and J. R. Overfelt [1], which claims to extend the classic Greiner-Hormann polygon clipping algorithm by handling of degeneracies. However, I ran into some difficulties with the procedure they describe. Consider the situation depicted on Figure 6(c) and suppose the polygons are oriented in the same way. Start the labeling phase from the I5 (as opposed from I1, as they do): for both subject polygon S and clipping polygon C, I5 has previous and next labels (on, on). Therefore, according to Table

Avoiding hoizontal lines and crazy shapes when plotting maps in ggplot2

為{幸葍}努か 提交于 2019-12-04 20:28:53
问题 I want a plot of an area, such as Latin America, using the world shape file from IPUMSI... https://international.ipums.org/international/resources/gis/IPUMSI_world.zip ... I will add some more IPUMS districts later so I really want to use this as my template layer. I having difficulty with the plot when I add limits through coord_map in ggplot2. The initial spatial file looks alright library("ggplot2") library("raster") sd0 <- readShapePoly("./IPUMSI_world.shp") df0 <- fortify(sd0) ggplot