polygon

Looking for a non “brute force” algorithm to remove intersecting areas of a collection of Rects

拟墨画扇 提交于 2019-12-06 03:11:06
问题 I have an n-sized collection of Rects, most of which intersect each other. I'd like to remove the intersections and reduce the intersecting Rects into smaller non-intersecting rects. I could easily brute force a solution, but I'm looking for an efficient algorithm. Here's a visualization: Original: Processed: Ideally the method signature would look like this: public static List<RectF> resolveIntersection(List<RectF> rects); the output would be greater or equal to the input, where the output

Is there a more efficient way to detect polygon overlap/intersection than PathGeometry.FillContainsWithDetail()?

给你一囗甜甜゛ 提交于 2019-12-06 02:23:30
问题 I have a method that is gobbling up 25% of my cpu time. I call this method about 27,000 times per second. (Yup, lots of calls since it's updating frequently). I am wondering if anybody knows a faster way to detect if 2 polygons overlap. Basically, I have to check the moving objects on the screen against stationary objects on the screen. I am using PathGeometry and the two calls below are using up 25% of the cpu time used by my program. The PointCollection objects I am passing just contain 4

Drawing a Polygon

房东的猫 提交于 2019-12-06 01:51:28
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, which I cannot find! No intersection :) Although Javascript is used to produce this polygon, please feel

Creating a 2D polygon in XNA

寵の児 提交于 2019-12-06 01:49:41
问题 I have some sort of a problem. I'm new to XNA and want to draw a polygon shape that looks something like this (In the end, I want these point to be random): So I read some articles and this is what I ended up with: private VertexPositionColor[] vertices; public TextureClass() { setupVertices(); } public override void Render(SpriteBatch spriteBatch) { Texture2D texture = createTexture(spriteBatch); spriteBatch.Draw(texture, new Rectangle((int)vertices[0].Position.X, (int)vertices[0].Position.Y

Point in Polygon using Winding Number

若如初见. 提交于 2019-12-06 01:26:22
问题 The question is: how do you determine if a point is within a polygon? This question has been asked and answered many times. There are multiple methods for determining whether a point is within a polygon. I've grokked the Winding Number algorithm, ported a solid answer from another SO thread into C# and written xUnit tests around it to ensure that I could refactor ruthlessly. The goal was to take an answer, all of which seem to use a procedural programming approach and variable names that are

Can one use polygon() or equivalent in lattice and ggplot2 plots?

﹥>﹥吖頭↗ 提交于 2019-12-06 00:06:12
问题 Is it possible to annotate lattice (or ggplot2 ) figures with elements created with polygon() (or elements created with a similar function) from the graphics library? I'm not too familiar with either library beyond examples of simple graphs posted on the web and printed in Deepayan Sarkar's book. Therefore, while I have code for what I've been doing in R with the graphics library, pointing me to relevant, equivalent functions and usage examples for lattice or ggplot2 specifically would be

WKT: how do you define Polygons with 3 rings (==2 holes)?

ε祈祈猫儿з 提交于 2019-12-05 23:54:09
问题 I found in here this document. I read it but I keep wondering how to define a Polygon with 3 rings in WKT? 回答1: You can use either the POLYGON or the MULTIPOLYGON type, but make sure the outer container ring is listed first followed by the inner hole rings. The orientations of the inner rings are not important since holes are explicit in the syntax. X & Y are space separated, coordinates are comma separated, and ring extents are limited by parentheses and separated by commas. Polygons (outer

Overlay ggplot grouped tiles with polygon border depending on extra factor

喜你入骨 提交于 2019-12-05 23:15:29
I have a data frame with x and y positions and two factor columns blocknr and cat: dput(testData) structure(list(xpos = c(2L, 8L, 5L, 8L, 1L, 4L, 5L, 1L, 8L, 4L, 3L, 2L, 6L, 5L, 1L, 7L, 3L, 4L, 3L, 7L, 1L, 6L, 7L, 7L, 2L, 5L, 3L, 4L, 6L, 7L, 1L, 5L, 1L, 6L, 4L, 5L, 3L, 6L, 4L, 8L, 1L, 3L, 4L, 6L, 7L, 3L, 2L, 6L, 4L, 2L, 1L, 7L, 4L, 8L, 2L, 3L, 2L, 5L, 8L, 2L, 8L, 3L, 3L, 5L, 6L, 7L, 1L, 5L, 6L, 4L, 2L, 6L, 7L, 1L, 5L, 7L, 2L), ypos = c(1L, 2L, 8L, 1L, 6L, 7L, 1L, 4L, 6L, 1L, 2L, 3L, 4L, 5L, 7L, 8L, 10L, 2L, 6L, 9L, 1L, 2L, 10L, 4L, 5L, 6L, 3L, 5L, 9L, 3L, 9L, 10L, 3L, 7L, 8L, 2L, 5L, 6L, 3L,

What are some recommended frameworks for manipulating spatial data in C++? [closed]

徘徊边缘 提交于 2019-12-05 22:45:42
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . What are some recommended frameworks for manipulating spatial data in C++? I'm looking for a polygon object, point object, and some

Leaflet/shiny: cannot draw reactive polygons

和自甴很熟 提交于 2019-12-05 21:33:49
Having looked through the Shiny integration example on the Leaflet for R page , I am having trouble subsetting and displaying some polygons for display in my shiny app. At the moment, i'm getting a app, with sidebar, but the main display is simply "Error:Don't know how to get path data from object of class reactive" The idea is to pick a country polygon from GB (3 countries) and display it alone, depending on the drop down choice; require(shiny) require(rgdal) require(rgeos) require(leaflet) cont <- readOGR(".\\mypath\\mypolygons.shp", "mypolygons", stringsAsFactors=FALSE) ui <- fluidPage(