polygon

How can I listen for the start of a user drawing a polygon in Google Maps v3?

这一生的挚爱 提交于 2019-12-07 14:52:46
问题 There's a polygoncomplete event that is fired, but I'm looking for a polygonstart event. Even an overlaystart event would work for me. When the user starts to draw a polygon, I want to remove any existing polygon on the map. Currently, I have that functionality implemented using the polygoncomplete event. It needs to happen at the start though. My pseudocode thought is to... Listen to click events on the map. onclick, check to see which drawing tool is selected (if that's possible). If

Using a C function in Objective-C (for iPhone)

雨燕双飞 提交于 2019-12-07 14:44:20
问题 'lo all. I am a self-described admitted noob in iPhone programming (having a much longer perl & web background -- 30 years)...but took the plunge last week and bought a couple of good books. After cramming and reading well over 1000 pages -- and understanding it pretty well, I am well on my way to a good first Native iPhone app. My problem is this: I do not know how to do a simple Geographic (lat/long) point-in-polygon routine in Objective-C. I have 2 ways of doing this. One in C (the first

Drawing a Polygon

拜拜、爱过 提交于 2019-12-07 14:21:17
问题 I am using Google Maps API V3 to draw a polygon based on a path, which is an array of random unsorted coordinate points (LatLng). This produces the shape below: Polylines intersect!! Problem: Since the shape of the Polygon depends on the order of the points in the path, how can I sort the path to create a polygon where no line intersects and no holes are formed? There is also a reference point (not shown in images) that the polygon must enclose. I believe this require a sorting algorithm,

Drawing textured polygons with libgdx

烈酒焚心 提交于 2019-12-07 12:36:56
问题 I'm having a problem with my rendering cycle using libgdx, basically I need to fill an area with a square texture, and the last part of this area may be smaller or with a different shape than the texture, so it means that i need to render a quad of arbitrary form and slap the texture on it, cutting the parts I don't need. I'm a bit lost on how to do this, so far I've seen that the PolygonRegion and PolygonSpriteBatch might do it for me, but I'm a bit wary of instancing a new heavy object I'll

Algorithm for fitting 2D polygons in an area?

不羁岁月 提交于 2019-12-07 10:33:06
问题 Is there a standard for this? Algorithm name? Say: I have 10 polygons of different sizes. I have an area of specific size. I want to know how to fill the most polygons in that area, and how they are fitted. Note: Polygons may be rotated depending on the restriction set. 回答1: One possible name is a Packing Problem. It is related to the Knapsack Problem. These problems tend to be NP-hard, and many require heuristics. If you can constrain the allowed forms of polygons and of the area, there may

PHP - Mask polygon over image

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 07:31:03
问题 Hi Everyone (this is my first post), I am trying to figure a way of cropping a polygon out of an image. I have been reading other similar code. It seems that most code is based around the following process: Resize the image to fit the width and height of the polygon shape, Create a blank image of an unusual colour the same size, Overlay transparent pixels in the shape of the polygon, Overlay that on to the resized image Set the unusual colour to be transparent... My problem is I do not want

Closest points of two polygons

依然范特西╮ 提交于 2019-12-07 06:11:59
问题 I have two polygons and I want to get the minimal distance and the points between this distance is measured. Of course such a point could very well lie on the edge between two nodes. Here is an example: I am looking for an algorithm that gives me the green distance and the two points. 回答1: If the polygons do not intersect, you could do this: If you have polygon A and polygon B and A[i] and B[j] are the vertexes of A and B respectively. Then you could compute the closest distance from A[i] to

How Do I Calculate the Area of a Polygon in a MySQL Database When the Polygon's Points are Lat Longs?

我的未来我决定 提交于 2019-12-07 05:53:35
问题 How do I calculate the area of a polygon stored in a MySql database? The polygons' points are lat longs. So, degrees and minutes seem to be causing a problem. I've tried: SELECT AREA( my_polygon ) FROM `my_table` WHERE name = 'Newport' Because, the points are lat longs, I get weird results. (I'm not able to switch to Postgre). Is there a way to do this in MySQL? I'd like to get the results in sq. meters or sq. km or sq. miles-- any of these would be fine. 回答1: You've got to transform those

Converting SVG paths with holes to extruded shapes in three.js

喜欢而已 提交于 2019-12-07 04:14:46
问题 I have a shape that consists of 4 polygons: 2 non-holes and 2 holes. This is only an example. In reality there can be a shape that consists of 50 polygons, of which 20 are non-holes and 30 are holes. In SVG path this like polygon can be represented easily by combining moveto:s and lineto:s. Every sub-polygon (hole or non-hole) in path string starts with moveto-command and ends with z (end) command and non-holes have winding order CW and holes CCW. Very easy and intuitive. The shape in SVG is

Polygon intersection error in Shapely: “shapely.geos.TopologicalError: The operation 'GEOSIntersection_r' produced a null geometry”

折月煮酒 提交于 2019-12-07 03:14:46
问题 I have been trying to debug this problem but unable to do so. I am trying to find the intersection of two Polygon objects. It works most of the time but for the following case, it raises the following exception: P1 area: 13.125721955 P2 area: 1.0 Traceback (most recent call last): File "geom2d.py", line 235, in <module> print p1.intersection(p2) File "/usr/local/lib/python2.7/dist-packages/shapely/geometry/base.py", line 334, in intersection return geom_factory(self.impl['intersection'](self,