polygon

Find polygon perimeter of points quickly in Javascript

时光毁灭记忆、已成空白 提交于 2019-12-24 00:56:55
问题 I'm making a terrain editor and I need to find the perimeter polygon of a set of points. If I just needed a convex hull then the speed would be no issue. To make a concave hull, I must go through a few hoops. I've figured out that I can triangulate the points and then throw away any triangles with a side longer than the known distance between the points. The next step is the problem: Combining the triangles (as mini polygons) into one large polygon using the JSTS geometry library (http:/

Android save polygon from map as bitmap same size for all devices

自古美人都是妖i 提交于 2019-12-24 00:54:33
问题 I am drawing polygon on Google map and it works great. What I need is to save this polygon as bitmap for fixed scale. I am using this code to do that. private static List<Point> scalePolygonPoints(List<LatLng> points, float scale, Projection projection) { List<Point> scaledPoints = new ArrayList(points.size()); LatLng polygonCenter = getPolygonCenterPoint(points); Point centerPoint = projection.toScreenLocation(polygonCenter); for (int i=0; i < points.size(); i++) { Point screenPosition =

Set Polygon Colors Matplotlib

与世无争的帅哥 提交于 2019-12-24 00:51:12
问题 I have a list of 10,000+ Matplotlib Polygon objects. Each polygon belongs to 1 of 20 groups. I want to differentiate which group a polygon belongs to by mapping each unique group to a unique color. Here are some posts I've found with similar issues to mine: Fill polygons with multiple colors in python matplotlib How to fill polygons with colors based on a variable in Matplotlib? How do I set color to Rectangle in Matplotlib? These solutions simply apply a random color to each shape in the

Split Self intersecting Polygon into non self intersecting polygon

梦想的初衷 提交于 2019-12-24 00:17:21
问题 I have a set of point which represent a self intersecting polygon.I am able to find the intersection point.But i am unable to split this polygon into smaller polygon which is not self intersection.Any idea how to do that.I am using vb 2008 .I need this to calculate the area of self intersecting polygon.Thank you 回答1: There is quite a bit known about this problem. In fact, there are earlier similar questions here on SO, e.g., "Divide self intersecting polygon (C Code)." Here is a Master's

How to convert a set of point coordinates from a concave hull into a polygon in R?

情到浓时终转凉″ 提交于 2019-12-23 19:14:53
问题 I have an alphahull::ashape() result that I need to convert with spatstat::owin() for subsequent spatial analyses. Is there an elegant solution how to order the points from the concave hull and convert the shape to an owin object or any Spatial* object? With ordered points in a hypothetical matrix coords the polygon is defined as: geo.owin=try(owin(poly=list(x=coords[,1],y=coords[,2])),silent=T) if(class(geo.owin)=="try-error") geo.owin=owin(poly=list(x=rev(coords[,1]),y=rev(coords[,2])))

clipping polygon against rectangle

梦想的初衷 提交于 2019-12-23 17:27:46
问题 today I have a (simple) rendering problem for you. My current project gets datas from a file to generate a SVG file. Drawing things as polygon is pretty easy thanks to the SVG format, but I have a single problem: some of my polygons are in AND out of the page (meaning that some parts of them are displayed while the rest is not shown due to the fact they are out of the display limit). In order to optimize the final SVG file I need to reduce my polygon to a simpler form. Consider the grey

Create square polygons from single centre coordinates and area in R

若如初见. 提交于 2019-12-23 12:34:30
问题 I am having issues plotting true to geographic extent pixels in R. the files come with a list of daily single coordinates and pixel size (area). There is also a Z element separate from this. The data structure looks this way: X <- c(1,3,6,7) Y <- c(3,2,7,8) Z <- c(38,23,12,12) Area <- c(32,23,45,67) The X and Y are in degrees longitude and latitude while the area is in square kilometres. I create the point features easily using: library(sp) A <- cbind(X,Y,Z,Area) B <- SpatialPoints(A) I plot

Java how to draw and fill a Polygon which has holes

天大地大妈咪最大 提交于 2019-12-23 12:16:11
问题 I am currently trying to draw and fill a Polygon which has a hole in it in Java. Normally this would not be a big problem, since I would draw the exterior ring and then draw the interior ring with the color of the background. But the problem is, that the polygon is displayed above a image which should be "seen" through the hole. I am writing the code in Java and am using JTS Topology Suite for my geometry data. This is my current code, which just paints the border and fills the polygon with a

Finding common outline of multiple polygons

最后都变了- 提交于 2019-12-23 09:27:15
问题 Im trying to find an algorithm for drawing a common outline between multiple polygons. What I mean is like on this picture: We have two rectangles (In my case they will not be rectangles, but polygons with most of their angles as right angle) and Im looking for common outline like a red path on second part of image. The biggest problem as I see it is finding new points which I marked yellow on the second part of image. The polygons will never intersect or touch itselfs. Im storing a polygon

Fill polygon with pattern doesn't work with leaflet

Deadly 提交于 2019-12-23 06:17:51
问题 I try to render a SVG polygon filled with pattern. SVG.path filled with pattern doesn't work. As you can see in this jsfiddle, filled background shows up transparent in Firefox and black in Chrome. The example is based on leaflet GeoJSON Example and uses the diagonalHatch pattern described by carto.net. <defs> <pattern id="diagonalHatch" patternUnits="userSpaceOnUse" x="0" y="0" width="105" height="105"> <g style="fill:none; stroke:black; stroke-width:1"> <path d="M0 90 l15,15"/><path d="M0