polygon

How to triangulate polygons in Boost?

允我心安 提交于 2019-12-20 21:21:38
问题 What is the best way to triangulate a polygon with Boost? I use Boost.polygon. My current algorithm: Compute a voronoï diagram from my polygon vertices. Create one directed polygon-edge for each cell-edge (this will create two directed polygon edge per cell-edge) Iterate over all created edges to create triangles (not trivial) Any better solution? Edit: I just realized that it is probably possible to walk through the cells in a special way to create the triangles directly (3 neighbor cells

Finding largest subset of points forming a convex polygon

匆匆过客 提交于 2019-12-20 11:55:55
问题 I'm looking for an algorithm for finding largest subset of points (by largest i mean in number) that form a convex polygon from the given set of point. I think this might be solvable using DP but i'm not sure. Is it possible to do this in O(n^3) ? Actually i just need the size of the largest subset, so it doesn't need to have unique solution Edit : just to keep this simple, Given input : a set of points in 2D Desired output : maximum number of points that form a convex polygon, like in the

Efficient extraction of all sub-polygons generated by self-intersecting features in a MultiPolygon

回眸只為那壹抹淺笑 提交于 2019-12-20 11:14:09
问题 Starting from a shapefile containing a fairly large number (about 20000) of potentially partially-overlapping polygons, I'd need to extract all the sub-polygons originated by intersecting their different "boundaries". In practice, starting from some mock-up data: library(tibble) library(dplyr) library(sf) ncircles <- 9 rmax <- 120 x_limits <- c(-70,70) y_limits <- c(-30,30) set.seed(100) xy <- data.frame( id = paste0("id_", 1:ncircles), x = runif(ncircles, min(x_limits), max(x_limits)), y =

Break a rectangle into randomly shaped polygons

↘锁芯ラ 提交于 2019-12-20 10:44:53
问题 Just like the title says, I need to break a rectangle into randomly shaped polygons. Example, with 7 polygons: +--------+--------+ |\ | 2 | | \ 1 |''--..__| | ------| 5 | | 3 / \________| | / /\ 6 | |__/ 4 / \______| | / 7 | +-----+-----------+ I don't know if there's an algorithm already out there for this, but I can't seem to get my head around this. I don't particularly care what language you answer in, but I'll be implementing in Java/Swing. 回答1: You may drop a bunch of random points on

Chrome: Bug with SVG polygon animation?

坚强是说给别人听的谎言 提交于 2019-12-20 04:55:32
问题 I created recently a hangman SVG graphic with animations, you can find it here: http://ykg-clan.de/svg/test/hangman_old.svg This works perfectly in Firefox - but in Chrome, the polygons and polylines do not get animated correctly. I've done this by setting the points on invisible first and then animating them to the desired position. Firefox seems to recognize that I wish that x x,y y,z z must become to a a,b b,c c because of the order of the coordinates. However, chrome does not get it. How

R - shade area between two crossing lines with different colors

对着背影说爱祢 提交于 2019-12-20 02:26:35
问题 I have a matrix (named ichimoku) with 516 rows and 2 columns ,each one of them containing values to be plotted, the goal is to recreate the clouds for the Ichimoku strategy. Using matpot, I am able to plot these two curves but what I want is to shade the area between the two curves. I have two problems : I tried using polygon to shade the area but it does not work. I suspect it is because the two series (senkouA and senkouB) cross several times on the plot instead of having one always greater

Converting polygon coordinates from Double to Long for use with Clipper library

与世无争的帅哥 提交于 2019-12-19 17:41:32
问题 I have two polygons with their vertices stored as Double coordinates. I'd like to find the intersecting area of these polygons, so I'm looking at the Clipper library (C++ version). The problem is, Clipper only works with integer math (it uses the Long type). Is there a way I can safely transform both my polygons with the same scale factor, convert their coordinates to Longs, perform the Intersection algorithm with Clipper, and scale the resulting intersection polygon back down with the same

Converting polygon coordinates from Double to Long for use with Clipper library

陌路散爱 提交于 2019-12-19 17:41:31
问题 I have two polygons with their vertices stored as Double coordinates. I'd like to find the intersecting area of these polygons, so I'm looking at the Clipper library (C++ version). The problem is, Clipper only works with integer math (it uses the Long type). Is there a way I can safely transform both my polygons with the same scale factor, convert their coordinates to Longs, perform the Intersection algorithm with Clipper, and scale the resulting intersection polygon back down with the same

Sorting voronoi cell vertices to compute polygon

 ̄綄美尐妖づ 提交于 2019-12-19 10:16:59
问题 I'm currently trying to get the clipped cells from a Polygon-Voronoi-Intersection. Here is what I've got so far: I have a polygon and computed some points in it to calculate a voronoi diagram and the red lines on the figure below are the voronoi edges. Then I used an algorithm to get the corner points from every cell and now I need to get the corners in the right direction (clockwise) to generate the cell polygon. Found Corners for one cell First I was using this method: private List<Vector>

Howto crop area outside polygon?

非 Y 不嫁゛ 提交于 2019-12-19 09:37:44
问题 I'd like to make transparent anything outside a predefined polygon in PHP. Let's say, you have the shape of your head then anything else of the image should be binned. Thanks a lot in advance! To make myself clear, here's some code I've been working on: $dat = dirname(__FILE__)."/foto_".time().".png"; $img = imagecreatefrompng("foto.png"); $points = array(93,36,147,1,255,-5,294,37,332,114,327,189,315,249,303,291,290,327,260,360,205,404,165,407,131,376,86,325,62,236,61,155,66,96,77,57,87,45);