polygon

Draw a self intersecting polygon on the HTML Canvas

筅森魡賤 提交于 2019-12-04 05:52:35
I'm looking for a way to draw a self intersecting polygon with holes, I'm using the HTML Canvas element. So given 5 points, I want to draw the red one below. This question is essentially the same thing. Note: I don't want to do this using line intersections and adding more points, the actual paths I will be using will be curved. You can't draw the first pentagram with a single path in Canvas 2D - the fill rule being used there is even-odd and Canvas fills shapes with the non-zero winding rule. I think you'll need to compute the intersection points for the corners of the interior pentagon and

Java library for creating straight skeleton?

坚强是说给别人听的谎言 提交于 2019-12-04 05:37:54
I have as an input a 2D polygon with holes, and I need to find it's straight skeleton, like in the picture: (source: cgal.org ) Maybe there is a good Java library for it? And if not, can you point me to the good explanation of the algorithm, so I could implement it myself? (I haven't found good resources on Google) I wrote this a little while back. Not sure if it's robust enough. https://github.com/twak/campskeleton (edited for 2018...) See http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html which contains an applet. Edit: Ah. I see that " Straight Skeleton " is a technical term. The

drawPolygon keeps drawing lines from starting (mousePressed) location to current (mouseDragged) location

ぐ巨炮叔叔 提交于 2019-12-04 05:37:47
问题 So, I'm trying to dynamically draw a Polygon starting from when I click the mouse until I stop dragging and release. Instead of, for the purpose of this question, a square outline being drawn when I click, drag down, then right-across, then up, then left-across, this is what happens: http://imgur.com/t8ZN3Pp Any suggestions? Notes: model.addPolygon() creates a Polygon with starting points and adds it to an ArrayList called 'polys' model.addPolygonPoint() adds points to this created polygon

Qt: Extract intensity values clipped by a region of interest polygon

大城市里の小女人 提交于 2019-12-04 05:22:21
问题 Based on a grayscale image and an ordered closed polygon (may be concave), I want to get all grayscale values that lie inside a region of interest polygon (as likewise described in SciPy Create 2D Polygon Mask). What is the most performant realisation of that in Qt 4.8? Endpoint should be some kind of QList<double> . Thanks for your advices. In addition, is it possible to compute a floating point mask (e.g. 0 for outside the polygon, 0.3 for 30% of the pixel area is within the polygon, 1 for

Finding Top Left and Bottom Right Points (C++)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 05:18:24
问题 I'm looking for some help with a project I'm working on. What I'm doing is a polygon approximation algorithm. I've got all of the points of my boundary, but in order to start the algorithm, I need to find the top left and bottom right points from the set of points. All of the points are stored in a structure array that has the x and y coordinates of each point. Any ideas on an easy way to loop through the array of points? Any help would be greatly appreciated. If you need more information,

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

二次信任 提交于 2019-12-04 04:29:29
I found in here this document. I read it but I keep wondering how to define a Polygon with 3 rings in WKT ? 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 ring plus any inner rings) are also limited by parentheses. Finally, inner rings cannot cross each other,

How to track event changes to a polygon with Google Maps API

纵然是瞬间 提交于 2019-12-04 03:53:39
I'm currently building a 'search an area' feature for a site we're working on. A bit like the one on Rightmove . I've got everything up and running except the ability to track event changes to a polygon (the setting of new points and altering existing ones). I need to be able to post the coordinates to the form for submission. I've tried the Google Code docs for editing events . And every time I try it out, I either get a message about 'set_at' not being possible or my object not being defined. I suppose the bit I know is wrong is thePolygon variable not being passed through to the new google

Google maps polygon optimization

霸气de小男生 提交于 2019-12-04 03:17:27
I extracted country outline data from somewhere and successfully managed to convert it into an array of lat-lng coordinates that I can feed to Google maps API to draw polyline or polygons. The problem is that that there are about 1200+ points in that shape. It renders perfectly in Google maps but I need to reduce the number of points from 1200 to less than 100. I don't need a very smooth outline, i just need to throw away the points that I can live without. Any algorithm or an online tool that can help me reduce the number of points is needed. Unreason I think MapShaper can do this online

How can I create a polygon using fields in PostgreSQL?

强颜欢笑 提交于 2019-12-04 00:58:26
问题 I have 8 real values in a table that I'd like to combine into a polygon. I haven't been able to figure out how to create a polygon using these values though. I keep trying variations of SELECT polygon(lat1,lon1,lat2,lon2,lat3,lon3,lat4,lon4) FROM table; but keep getting errors about the polygon function not existing or an invalid input syntax for type polygon. Has anyone done this before? 回答1: The syntax for a regular postgres polygon is more like: insert into geo_table values (1, '((2,2),(3

Bind Marker with polygon vertices google mapv3

爱⌒轻易说出口 提交于 2019-12-03 23:03:43
问题 I am trying to bind the markers with the polygon vertices. Right now i am drawing marker and polygon separately. You can see in the code. But i want that, at the time of marker drawing the markers also bind to the polygon vertices. var markers = new Array(); var polycoordinate = Array(); for(var i = 0; i < location.length; i++) { marker = new google.maps.Marker({ position : new google.maps.LatLng(location[i][0], location[i][1]), draggable : true, map : map }); google.maps.event.addListener