One option is to use code from Mike Williams' eshapes ported to v3. proof of concept fiddle from his documentation for a RegularPoly: Plots a regular polygon (e.g. pentagon, square, octagon) with a specified centre, radius, number of vertices, and rotation. Parameters latlng Centre of the shape radius Length of...

If you specifically want to construct your Polygon from the shapely geometry Points, then call their x, y properties in a list comprehension. In other words: poly = Polygon([[p.x, p.y] for p in pointList]) print(poly.wkt) # prints: 'POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))' Note that...

Here is a method slightly different that yours (but only slightly). Inspection of [email protected] reveals that, while there are 11 FeatureIDs (representing ethnicitity's), there are only 4 unique named ethnicity's (German, Italian, and French Swiss, and Rhaetoromanians). So the result below is based on the names, not the IDs. library(rgeos)...

mongodb,leaflet,polygon,openstreetmap,circle

Since you're using MongoDB, the best solution here is (if that's possible), to handle this in the database. Put 2dsphere indexes on your document's loc field and use a $geoWithin query in combination with $centerSphere: The following example queries grid coordinates and returns all documents within a 10 mile radius...

python,python-2.7,polygon,maya,pymel

You can force exit the context with cmds.setToolTo('selectSuperContext') which will switch you to the select tool and complete the poly tool. However that's not going to work as you've laid it out here, I think: you'll swicth to the tool and immediately switch out without waiting for the user to...

UPDATE Thank to Hoki's suggestion, I finally able to work it out. Note that I change this part inside the code: validpoint = inpolygon(point_x,point_y,bhex_x,bhex_y) & ~inpolygon(point_x,point_y,shex_vertices_x2,shex_vertices_y2); Hopefully, this clear the confusions and would help other users as well. I would like to thank Hoki and xenoclast for their help. The...

Just use java.awt.Polygon. The constructor to create Polygon public Polygon(int xpoints[], int ypoints[], int npoints) Than use either of public boolean contains(Point2D p) public boolean contains(double x, double y) passing the point x and y...

libgdx,polygon,triangulation,convex,concave

The problem is with your loop: // Make triangles for (int i = 0; i < pointsCoords.size / 6; i++) { trianglesVertices.add(new float[] { pointsCoords.get(i), pointsCoords.get(i+1), pointsCoords.get(i+2), pointsCoords.get(i+3), pointsCoords.get(i+4), pointsCoords.get(i+5), }); Polygon triangle = new Polygon(trianglesVertices.get(i)); triangles.add(triangle); } First triangle will have correct coordinates, but second one will will use...

algorithm,math,geometry,polygon,intersection

You could just iterate over the edges of your polygon and check whether one of them intersect your square. If one does then you are done. Otherwise just test whether either 1) the center of the square belongs to the polygon 2) an arbitrary point in the polygon belongs to...

android,google-maps,google-maps-android-api-2,polygon

There's already a library for that. import com.google.maps.android.SphericalUtil; //... List<LatLng> latLngs = new ArrayList<>(); latLngs.add(new LatLng(51.893728, -8.491865)); latLngs.add(new LatLng(51.893550, -8.492479)); latLngs.add(new LatLng(51.893216, -8.492224)); latLngs.add(new LatLng(51.893404, -8.491598)); Log.i(TAG, "computeArea " + SphericalUtil.computeArea(latLngs)); For me the output is computeArea 1920.8879882782069...

Here you go. You need the sp and rgeos packages: spokey <- function(xy,n=20){ xcent = mean(xy[,1]) ycent = mean(xy[,2]) cent = sp::SpatialPoints(cbind(xcent, ycent)) pts = sp::SpatialPoints(xy) ## take the furthest distance from centre to vertex, times two! r = 2 * max(sp::spDistsN1(pts, cent)) theta=seq(0,2*pi,length=n+1)[-(n+1)] ## construct a big wheel of...

java,android,libgdx,polygon,triangulation

You need to clear the screen at the beginning of each frame. Refactor your render method to be something like this... @Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); polyBatch.begin(); polySprite.draw(polyBatch); polyBatch.end(); } ...

html,css,animation,svg,polygon

In addition to @web-tiki's answer, you can also apply :hover and keyframed animations to selected 'components / elements' of the SVG by applying IDs & Classes. Hover the "S" for instance. JSfiddle Demo @import url(http://fonts.googleapis.com/css?family=Lato); body { background-color: #2F2724; font-family: lato, sans-serif; } .main { text-align: center; } .letterS {...

Polygon series can be accessed via event.currentTarget. Example: http://jsfiddle.net/ow72qjaw/ Tooltip can be disabled by setting: tooltip: { enabled: false } Hover effects can be disabled for series by using proper settings: states: { hover: { enabled: false } } If you want to disable tooltip for selected series only you...

c#,list,loops,polygon,triangulation

I hope I understood the question correctly: Your problem is to calculate the neighbor indices at the end of your node list, right? If so, why don't you just calculate the indices using a simple modulo function as that: int mod(int k, int x) { return ((k % x) +...

python,polygon,mesh,maya,vertex

The ugly way is the easy way - if you string split the vertex entries on period you'll get the transform parents. However you can also pass vertex entries to cmds.ls(o=True) which strips off attribute and component names and returns only objects: cmds.select("pCube1.vtx[*]") sel = cmds.ls(sl=True) print sel # [u'pCube1.vtx[0:7]']...

r,maps,polygon,voronoi,spatstat

The following function was provided by the package authors. It uses the fact that the deldir() function's dirsgs structure outputs the start/end coordinates of each line in the tessellation along with the point indices. These can be converted to a psp line segment pattern which can easily provide the length...

matlab,polygon,mesh,finite-element-analysis

I made sth like that: matX = [0,0.2,0; 0.2,0.2,0; 0.2,1,0.2; 1,1,0.2; 0,0.2,0; 0.2,0.2,0; 0.2,1,0.2] matY = [0,0,0.5; 0,0.5,0.5; 0,0,0.5; 0,0.5,0.5; 0.5,0.5,1; 0.5,1,1; 0.5,0.5,1] x = zeros(7,4); y = zeros(7,4); for i=1:7 x(i,:) = [matX(i,1),matX(i,2),matX(i,3),matX(i,1)]; y(i,:) = [matY(i,1),matY(i,2),matY(i,3),matY(i,1)]; plot(x(i,:),y(i,:)) hold on end Mesh: Have anyone better and more sophisticated solution?...

r,polygon,heatmap,fill,pheatmap

To understand how this works, I had to look into the code of pheatmap. Let's first generate a matrix: A <- matrix(1:10, 2, 5) The default palette is defined as pal <- colorRampPalette(rev(RColorBrewer::brewer.pal(n = 7, name = "RdYlBu")))(100) The idea is then to define break values and assign a color...

polygon,openstreetmap,street-address,overpass-api

You will need the way in order to retrieve the order of nodes. This can't work otherwise, imagine a way including one or more nodes twice. Remove the node(w); part from your query and take a look at the <way> elements. If there are multiple <way> elements then you will...

There is an interaction between the loop and remove() which you've missed: If you remove an entry in the array, then the indexes of all further elements change. That means if you remove item #2, then item #3 becomes #2. Your loop then sets the index to 3 which means...

html,css,css3,css-transitions,polygon

An approach trying to push it to the limit. This is of course experimental code, since it is just supported in Chrome, as far as I know, and somehow in a buggy way. clip path can not be animated if you don't make it easy for the browser. That is,...

An algorithm to easily do this: Sutherland-Hodgman A better but more complex and computationally more expensive algorithm is Weiler-Atherton i have always used Sutherland-Hodgman's algorithm thus far and never encountered any problems....

You have capitalised the 'L' of LeftEar in the final line.

javascript,openlayers,polygon,marker

I have resolved the issue using below code. The purpose of posting answer is it might help other people who are searching for the same. I am calling controlFeatureHandler function when Polygon created. function controlFeatureHandler(e) { getIntersectsMarkers(e.feature); } Also calling controlFeatureHandler function when particular Polygon was selected. function updateFeatureTable(featureList) {...

First, your soa shapefile has 1817 elements, each with a unique code (corresponding to lookup$OA11CD). But your lookup file has only 1667 rows. Obviously, lookup does not have "a list of all OA codes". Second, unless lookup has the same codes as your shapefile in the same order, using gUnaryUnion(...)...

A WPF UIElement has to be laid out before being visible. It has to get at least one Measure and Arrange call, where it gets an available Size and a final arrange Rect (usually from its parent Panel). When rendering a newly created element into a RenderTargetBitmap, you would call...

The answer is obvious, stupid me...(Facepalm) You just have to add the first point at the end of the array. Float[] xTolerances = new Float[xTol.length+1]; Float[] yTolerances = new Float[yTol.length+1]; for(int i = 0; i< xTol.length; i++) xTolerances[i] = xTol[i]; //add here the first x coordinate at the end of...

google-maps,google-maps-api-3,polygon

One option would be to use the v3 ported version of Mike Williams' v2 Eshapes library // ==- Tilted rectangles === var point = new google.maps.LatLng(44, -78); var tiltedRectangle1 = google.maps.Polygon.Shape(point, 50000, 10000, 50000, 10000, -60, 4, "#000000", 3, 1, "#ffffff", 1, {}, true); var tiltedRectangle2 = google.maps.Polyline.Shape(point, 50000, 10000,...

(link to related java code below) To create the mask border, do the following: for each pair of coordinates (x,y) check if any one of 8 its neighboring points is outside the mask. However, keep in mind that the resulting mask isn't necessarily 1 pixel wide and vectorizing it might...

google-maps,zoom,polygon,geospatial

Process the path returned from google.maps.geometry.encoding.decodePath(googlePolygon) to create a bounds object for it, then use google.maps.Map.fitBounds with that bounds. var polyPath = google.maps.geometry.encoding.decodePath(googlePolygon); var bounds = new google.maps.LatLngBounds(); for (var i=0; i < polyPath.length; i++) { bounds.extend(polyPath[i]); } map.fitBounds(bounds); ...

Does this help? ee <- lapply(regions, function(x) gIntersection(ec, er[er$CODE == x, ], byid = TRUE, drop_not_poly = TRUE)) This gives you a list of SpatialPolygonsDataFrames, one for each region. Which you can access in the usual way, e.g. ee[[1]] plot(ee[[1]]) # to plot the first region with counties Edit Your...

You need to convert your second image to raster (see here). sp.grid <- cbind(grid, col = predict(m, grid)) coordinates(sp.grid) <- ~ x + y gridded(sp.grid) <- TRUE sp.grid <- raster(sp.grid) Then your attempt works. grid.pols <- rasterToPolygons(sp.grid, n = 16, dissolve = TRUE) plot(grid.pols) class : SpatialPolygonsDataFrame features : 3...

Well, triangle has the height of 4, rectangles have height of 5, and that's what you can see here :) try: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="5" height="5"> <polygon points="0,0 0,5 5,2.5" style="fill: red;" /> </svg> ...

javascript,google-maps-api-3,polygon

Push is simply adding items to the array it has nothing to do with Google Maps API. For a polygon to know its "closed" - make sure your first and last point in the array of points are the same - otherwise its not a valid polygon. if its not...

ios,cocoa-touch,swift,geometry,polygon

If the first (i=0) vertice is fixed at the middle of top rectangle edge, we can calculate minimal width and height of bounding rectangle: The rightmost vertice index ir = (N + 2) / 4 // N/4, rounded to the closest integer, not applicable to triangle MinWidth = 2 *...

sql-server,polygon,circle,spatial

NOTE: Requires SQL 2012 or higher. Now I understand completely what you are looking for, you'll find the STCurveToLine() method useful. For instance: DECLARE @circle GEOGRAPHY; SET @circle = GEOGRAPHY::STGeomFromText('CURVEPOLYGON(CIRCULARSTRING(2 4, 4 2, 6 4, 4 6, 2 4))',4326); SELECT @circle.STCurveToLine().STAsText(); This will return a POLYGON instance. Depending on the...

java,polygon,indexoutofboundsexception,fill

This loop is your problem. You are walking the array two places at a time (i+= 2), but you are doing it until i < xcoord.length. So when i == (xcoord.length - 1), that is xcoord[i] is the last element of the array, in your method call to drawMyHorizontalLine, xcoord[i...

c#,geometry,shader,game-engine,polygon

which way is left/right on a line? from last edit is this not your case why not use dot protuct ? so if the line goes in -x direction the result is negative if in the +x direction then the result is positive if the result is zero that...

Very cool. Didn't know mysql had this feature. To construct a point, use no comma: 'POINT(-33.7507 151.1445)' fiddle...

algorithm,2d,polygon,rectangles

Let's solve the problem for the case if we can only move our polygon P to the right and the width of the cell equals w. First of all, notice that it is enough to explore shifts for the distance dP in [0; w), because if we move P to...

It seems like you are a bit confused and you are mixing two absolutely independend things: Box2D, a physics engine, which does all physic calculations (including collission detection) for you. The Rectangle, Polygon and the Intersector class of libgdx. I try to explain what both of them do and why...

java,math,collision-detection,polygon

The easy way to solve this that I've found is to convert Shapes (in your case Polygon(2D?)) into Areas. You can use Area.intersect(Area) to see if two Areas have collided

There are pretty good implementations from the iSurfer The two methods used in most cases (and the two I know of) are crossing number and winding number. Both of them are not affected by the signs of the polygon/point coordinates. So it must be a bug in your code. For...

python,polygon,shapely,multilinestring

Probably not the best code, but I solved it by loading the points shapefile (where the points attributes were), the lines shapefile (where the lines attributes were) and polygons (buffered points). Then I used 2 'for' to check if each buffered point intersected each line. If it did, I retrieved...

The easiest way is to using Path: <Path Stretch="Fill" Width="100" Height="100" Fill="Green" Data="M4.1561281,2.2702953 L4.8524521,2.2702954 4.8509674,3.963097 5.8969377,3.9630803 5.8969378,5.0916036 4.8524628,5.1061913 4.8524521,6.7843885 4.1561281,6.7843887 4.1559771,5.0877741 3.1116421,5.0916036 3.1116421,3.9630803 4.1556735,3.9654722 4.1561281,2.2702953 z"/> This Path you can easily edit in Blend using "Direct Selection". Polygon example: <Viewbox Width="50" Height="50"> <Polygon Name="myPolygon" Fill="Green"...

buffer,polygon,geospatial,spatial,arcgis

If I understand what you want correctly, then creating the union of buffers won't help you - as it leaves you with a single object and you need the count of all buffered objects intersecting against every object in the original table. In SQL I would join the original (all...

java,netbeans,jframe,polygon,repaint

Whether drawing to the JFrame was frowned upon or not...it does not matter as this was just for a learning experience and I know that I should draw to a JPanel instead. I fixed my issue for this occurrence of testing just by adding the super.paint(g); call inside my call...

The primary advantage will be if you actually want to perform geometric operations on those polygons within the database, or perform searches based on the polygon coordinates. If you're just using the DB as a store, with some other column as the retrieval key, then you might as well store...

sql-server-2008-r2,polygon,geospatial,sqlgeography

In short, yes it is possible. I would suggest you start with the following MSDN link and do a little research from there: Working with Spatial Data Specifically, note the following methods available for use in getting your answer: STWithin() STIntersects() Please note that with SQL 2008 R2, you are...

Try with ggplot (I have changed the case value of rows 11:20 to 2): ggplot()+ geom_density(data=testdf[testdf$case==1,], aes(age),fill='red', alpha=0.5)+ geom_density(data=testdf[testdf$case==2,], aes(age), fill='green', alpha=0.5) ...

You could use a basic SVG path http://codepen.io/anon/pen/XbaKLp <svg width="300px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="M5 5 L170 3 L295 15 L280 95 L130 80 L110 95 L20 85" stroke="transparent" fill="#8eab32"></path> </svg> Mx y represents the first coordinates; Lx y represents a straight line from previous coordinates to (x, y). (you...

mysql,csv,phpmyadmin,geometry,polygon

You can't import geometry type easily. I'd suggest creating temporary table CREATE TABLE IF NOT EXISTS `tmptbl` ( `a` int(11), `b` int(11), `c` varchar(255), `d` text, `e` text ) Import csv into that table, then convert it into your table using INSERT INTO mytable (CellId,Type,Name,Geometry,Centroid) SELECT a,b,c,GeomFromText(d),PointFromText(e) FROM tmptbl ...

mysql,polygon,geospatial,spatial

Seems like a bug with SQLYog GUI. The data is getting inserted into the MYSQL properly but SQLYog does not show the same. Had to manually check from the mysql command prompt. The data was indeed present in the database. If the query fired is incorrect, then SQLyog will show...

javascript,google-maps,svg,path,polygon

You can't use the coordinates directly, you first must translate them to points based on a projection. For the mercator-projection you'll find the formula here: http://stackoverflow.com/a/14457180/459897 A javascript-function based on this formula may look like this: /** *@param latLng object with properties lat and lng(of the coordinate) *@return object with...

javascript,angularjs,google-maps-api-3,polygon

Into your addNewPoly function you pass an array of coordinates, coorArray2: function addNewPoly(coorArray2) However you never use it, you're referring to coorArray: for (i = 0; i < coorArray[0].length; i++) { element1 = coorArray[0][i][1]; element2 = coorArray[0][i][0]; triangleCoords.push(new google.maps.LatLng(element1, element2)); } Change this and it should work for (i =...

algorithm,binary-tree,polygon,triangulation

Here's a recursive bijection. The base case is that the degenerate 2-vertex polygon corresponds to the empty tree. Inductively, the tree has at least one interior node. Assume that the vertices of the polygon have preexisting labels from 1 to n in clockwise order. Examine the unique triangle T that...

Assuming the length you're generating is the distance from the origin of the asteroid and not the length of the side, then the following should give you the (x,y) coordinates of an entry. // ... double angle = entry[0]; double length = entry[1]; double x = Math.cos(angle) * length; double...

java,gis,polygon,intersection,concave

Well I figured it out. I took the vertex list for the intersection polygon (blue), iterated through each pair of point, cast each line segment in the two original polygons as LineSegment2D objects and used the .contains method to check if each pair of points was in one of the...

java,libgdx,collision-detection,polygon

The best way to handle those collisions would be to use a physics engine like Box2D which already comes packed with Libgdx. When a collision occurs in Box2D a event gets fired and you can easly handle that event. So you should probably take a look here. Of course there...

sql,polygon,geospatial,spatial

For whoever it may be useful, I have eventually used 'Intersects' method which seems to be working fine

c++,multithreading,visual-studio-2013,polygon,wm-paint

The short answer is that GDI simply isn't designed to support drawing from multiple threads into the same DC simultaneously. That leaves you with a few choices. The most direct would be to use PolyPolygon to draw all your polygons (or at least large numbers of them) in a single...

math,rotation,geometry,processing,polygon

With a small number of vertices it might be worth checking the distances between each vertex and the others. In your square example dist(p1,p2), dist(p1,p3), dist(p1,p4), dist(p2,p3), dist(p2,p4) and dist(p3,p4). These values will exist for each polygon. There will be a point that has the same distance set as p1,...

Here is the Code triangle1 = new Polygon(); triangle1.addPoint(400, 550); //left triangle1.addPoint(600, 550); //right triangle1.addPoint(500, 350); //top triangle2 = new Polygon(); triangle2.addPoint(600, 550); // left triangle2.addPoint(700, 350); //top triangle2.addPoint(800, 550); //right triangle3 = new Polygon(); triangle3.addPoint(500, 350); //left triangle3.addPoint(700, 350); //right triangle3.addPoint(600, 150); // ...

c#,windows-store-apps,polygon,scrollviewer,stackpanel

Put another container control between the StackPanel and the Polygon. An intermediate Grid will let you control their placement by row and column as normal. An intermediate StackPanel will let the Container stack and Polygon stack separately from the items within the Container stack: <ScrollViewer> <Grid> <StackPanel x:Name="Container" HorizontalAlignment="Left" VerticalAlignment="Top"...

Perhaps this can get you started. You'll need to replace the colour ramps with the A3 table colours. # create a 6 plot layout, with a tall top row and narrow bottom row layout(mat=matrix(data = 1:6, nrow = 2, byrow=T), heights=c(3,1)) # standard left, bottom, top and right margins par(mar=c(5,4,4,2)+0.1)...

It's most likely either of two things: Your normals are pointing to the backside. To fix this, select the faces with a hard edge and go to the Polygons window menu, Normals -> Reverse. You have hard edge. Select the faces, edges or the whole object and go to the...

c#,.net,geometry,polygon,partitioning

You can find intersections of your polygon with every cell of Voronoi diagram using, for example, Clipper library. AFAIK, it allows to clip polygon against open voronoi cell (polyline) Edit After quick check: library can only clip polyline by closed polygon, returning part of polyline that is inside the polygon....

The coordinate system has origo in the top-left corner, and the y-axis increasing downwards. This is why you get a downward slope when you increase the y-coordinate....

merge,polygon,qgis,feature-selection

Overally merging features is working. But there is a big issue when one features has issues. All you need to do is checking the to be merged features. Solve any issue like multiple points or intersections. Now try merging them again and it should work. At least for myself it...

They are inverse relationships: A contains B, and B is within A. >>> A.contains(B) True >>> B.within(A) True +----------------------------------+ | | | +----------+ | | | | | | | | | | | | | | | | | | | | | | | B | | |...

openlayers,polygon,gwt-openlayers

The problem is that you are adding both LinearRings to the same Polygon. All rings, after the first, are defined as inner rings of a polygon (ie, internal holes), which explains the strange intersection behavior you are seeing -- an attempt to draw an inner ring, which is not in...

c#,order,geometry,polygon,intersection

iterate through the lines first in an outer loop, then for each line get the 2 points in the specific order you want. Modify your code to put the two found itxns in temporary list, instead of directly into intersections collection - then, in between the inner and outer loop...

Here's a possibility adapted from @kohske's answer here. All credits to him. Additional data points are generated by linear interpolation, and plot is made by geom_area. First, a smaller example to make it easier to get a feeling for the linear interpolation and which points are added to the original...

I'm not really sure what you're trying to achieve here, but if you want the polygon to appear above the image, you'll have to put the position and z-index style attributes in the <svg> tag. Does this help? body { display: flex; flex-direction: column; height: 100vh; } footer { position:...

As per Jonas' comment above, PsychoPy uses a layering system in which subsequent stimuli are drawn on top of previous stimuli (as in his code examples). In the graphical Builder environment, drawing order is represented by the vertical order of stimulus components: stimuli at the top are drawn first, and...

The problem is since Polygon will allow only straight lines achieving a curve effect would be difficult You have two options 1)Use Blend to Create Path eg <Path Data="M0.037120935,318.97711 L3.0000002,319 0,319 z M517,5.0000003 L517,319 3.0000002,319 C286.87436,319 517,178.4174 517,5.0000003 z M517,0 L517,5.0000003 516.89777,0.063097671 z" Fill="#FFFB0404" Stretch="Fill"/> 2)create the triangle first and...

java,algorithm,polygon,intersection

Polygons 1, 2 and 3 are the same thing. :-) You can get Area Gamma by using intersect(). Then you can subtract() Area Gamma from Polygon A to get Area Alpha (the part of A that's outside Gamma), and subtract() Gamma from B to get Beta (the part of B...

You haven't set an fx:id on the Canvas in your fxml file. You need <Canvas fx:id="canvas" height="444.0" layoutX="6.0" width="588.0" /> The value of the fx:id attribute must match the variable name in the controller. You didn't show the context in which you call the drawShape() method; you need to be...

Something like the following should do the job: typedef Gps_traits_2::General_polygon_2 General_polygon_2; const General_polygon_2& outer_boundary = offset_poly.outer_boundary(); General_polygon_2::Curve_const_iterator cit=outer_boundary.curves_begin(), cit_end=outer_boundary.curves_end(); for(;cit!=cit_end;++cit) { bool is_linear = cit->is_linear(); std::cout << cit->source() << " " << cit->target() << "\n"; } The list of all member functions are given here....

google-maps,google-maps-api-3,polygon

I guess I have discovered enough to provide an answer, if it's helpful to anyone. I've done this: Downloaded the Admin 0 - Countries dataset from the Natural Earth site Loaded ne_110m_admin_0_countries.shp in QGIS In QGIS right-clicked this layer, and saved with a new name On my new layer I...

java,swing,user-interface,graphics,polygon

In the paint() method I create a new instance of the class that contains the methods to draw and fill the polygon. Therein lies the reason for my problem. A new instance of the class is created every time that paint() is called so the arrays that I have...

numpy,matplotlib,polygon,shapely

This type of intersection is easily done by the "min of the maxes" and "max of the mins" idea. To write it out one needs a specific notion for the rectangle, and, just to make things clear I'll use a namedtuple: from collections import namedtuple Rectangle = namedtuple('Rectangle', 'xmin ymin...

algorithm,sorting,math,polygon

First of all please consider that for a general matrix the output can be composed of more than one closed loop; for example boundaries of the matrix form three distinct loops, one of them placed inside another. To extract these loops the first step is to build a map of...

You can do it simply with imcontour or bwboundaries. Here is an exemple: % Get the values in your image val = unique(im); % Pre-allocate output C = cell(numel(val),1); % Here we go for i = 1:numel(val) C{i} = bwboundaries(im==val(i)); end The output C will be a cell of cells,...

You can try alpha shapes. Basically it a delaunay triangulation without edges exceeding alpha. You can also traverse the convex hull of the triangulation and use a point in polygon test, for example with the rays method.

java,awt,coordinates,polygon,java-2d

I toyed around with the A* algorithm this week. There may be other solutions to your request, but since I already have the code, it was just a matter of adapting it to your needs. However, for your specific requirement you could also simply use a primitive flood-fill algorithm and...

java,swing,polygon,rounded-corners

For more control over the rounded corners (beyond using a Stroke), you can combine 3 lines for the sides, and 3 bezier curves for the rounded corners. Use linear interpolation to get the start/end point of the lines and curves, with the corner points being the control point for the...

java,algorithm,netbeans,polygon,clipping

The problem with the algorithm was something as simple as missing parenthesis to separate different parts of the formulas that determined the new coordinates of the clipped lines. It functioned well after that was resolved.

You don't need to use JQuery. A CSS transition will do fine. To keep things simple, use a <g> element with a transform attribute to move the coordinate origin to the middle of the object you want to scale. That way it will stay in the same place instead of...

java,android,sql,postgresql,polygon

I did solve this, I used an ArrayList of LatLng and it works just fine. I will post the code and explain it below for whoever will encounter this problem in the future. //initialize an ArrayList of LatLng type. ArrayList<LatLng> border = new ArrayList<LatLng>(); if (dbops.connect(DB_URL, DB_USER, DB_PW).isValid(1)) { dbops.disconnect();...

In the CAD industry, we would call this operation a 2d sweep, or a 2d planar sweep; in this case a 2d planar rotational sweep. (Not to be confused with a sweep line algorithm.) The resulting area would be the 2d swept area or 2d swept face, and the outline...

You have to take two more things into account. First, the Grid may align (i.e. move) the whole stretched Polygon according to its HorizontalAlignment and VerticalAlignment properties. If you don't want to calculate that by yourself, you could get an appropriate GeneralTransform object by myPolygon.TransformToAncestor(grid): var polygonGeometryTransform = myPolygon.RenderedGeometry.Transform; var...