point

matplotlib.Path.contains_points : “radius” parameter defined inconsistently

懵懂的女人 提交于 2019-11-30 18:29:32
问题 Problem: The radius parameter in the function contains_point in matplotlib.path is defined inconsistently. This function checks if a specified point is inside or outside of a closed path. The radius parameter is used to make the path a little bit smaller/larger (dependent on the sign of radius). In this way, points can be taken into/out of account, which are close to the path. The problem is, that the sign of radius depends on the orientation of the path (clockwise or counterclockwise). The

Check if a point is in polygon (maps)

眉间皱痕 提交于 2019-11-30 17:43:34
问题 I'm trying to check if a point is in polygon. At the moment I have try with this function pointInPolygon:function (point,polygon){ var i; var j=polygon.length-1; var inPoly=false; var lon = point.longitude; var lat = point.latitude; for (i=0; i<polygon.length; i++) { if (polygon[i][0]<lon && polygon[j][0]>=lon|| polygon[j][0]<lon && polygon[i][0]>=lon){ if (polygon[i][0]+(lon-polygon[i][0])/(polygon[j][0]-polygon[i][0])*(polygon[j][1]-polygon[i][1])<lat){ inPoly=!inPoly; } } j=i; } return

Solr spatial search with input point and query which polygon within

馋奶兔 提交于 2019-11-30 17:27:36
问题 I have some polygons indexed in Solr. Is it possible to query with a point(lat,lon) and see which polygon has that point inside? 回答1: Yes it is possible and described here: http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 Your Solr Version must be 4 or higher and you have to import the JTS jar-file which you can get from http://sourceforge.net/projects/jts-topo-suite/ You have to define a field with a fieldType of location_rpt <fieldType name="location_rpt" class="solr

Delphi array initialization

淺唱寂寞╮ 提交于 2019-11-30 17:14:00
I currently have this, and it sucks: type TpointArray = array [0..3] of Tpoint; class function rotationTable.offsets(pType, rotState, dir: integer): TpointArray; begin Result[0] := point(1, 1); Result[1] := point(1, 2); Result[2] := point(1, 1); Result[3] := point(1, 1); end; but instead, i want to do something like this: class function rotationTable.offsets(pType, rotState, dir: integer): TpointArray; begin Result := [Point(1,1), Point(1,2), Point(1,1), Point(1,1)]; end; However, on compilation, it complains that the [1, 2, 3, 4] syntax can only work for Integers. Is there a way to

Convert a shapefile from polygons to points? [closed]

依然范特西╮ 提交于 2019-11-30 16:24:38
I have a non-overlapping polygon-based shapefile (.shp) with a large spatial extent and many dozens of associated attributes. The shapefile is projected in UTMs. I would like to convert the polygons to points spaced out in a 30-m resolution grid, in which each point would retain the attributes of the polygon it is located within. Output would simply be a table of the points: X, Y, attribute1, attribute2, attribute 3,etc... I would ideally like to do this operation in R, or (less ideally) some other free program I can run on a Mac. NOTE: I'm throwing this up in part to learn whether there's a

Snap point to a line

徘徊边缘 提交于 2019-11-30 16:03:22
问题 I have two GPS coordinates which link together to make a line. I also have a GPS point which is near to, but never exactly on, the line. My question is, how do I find the nearest point along the line to the given point? 回答1: Game Dev has an answer to this, it is in C++ but it should be easy to port over. Which CarlG has kindly done (hopefully he does not mind me reposting): public static Point2D nearestPointOnLine(double ax, double ay, double bx, double by, double px, double py, boolean

Snap point to a line

非 Y 不嫁゛ 提交于 2019-11-30 15:45:16
I have two GPS coordinates which link together to make a line. I also have a GPS point which is near to, but never exactly on, the line. My question is, how do I find the nearest point along the line to the given point? mlk Game Dev has an answer to this , it is in C++ but it should be easy to port over. Which CarlG has kindly done (hopefully he does not mind me reposting): public static Point2D nearestPointOnLine(double ax, double ay, double bx, double by, double px, double py, boolean clampToSegment, Point2D dest) { // Thanks StackOverflow! // https://stackoverflow.com/questions/1459368/snap

Test if point is in some rectangle

a 夏天 提交于 2019-11-30 13:57:47
问题 I have a large collection of rectangles, all of the same size. I am generating random points that should not fall in these rectangles, so what I wish to do is test if the generated point lies in one of the rectangles, and if it does, generate a new point. Using R-trees seem to work, but they are really meant for rectangles and not points. I could use a modified version of a R-tree algorithm which works with points too, but I'd rather not reinvent the wheel, if there is already some better

How to pan an image using your mouse in Java Swing

六月ゝ 毕业季﹏ 提交于 2019-11-30 10:01:35
I am creating a Java app that will allow users to view images and to pan the image using their mouse. To implement the panning of the image I use a combination of mouseClicked and mouseDragged events using JViewports. The bulk of the code is in the mouseDragged method public void mouseDragged(MouseEvent e, WindowWrapper w) { final JViewport vp = someFieldViewPort; //Getting the point that the mouse is dragged to to Point cp = e.getPoint(); final Point vPoint = vp.getViewPosition(); //I found the image went off the content to show the white border so I included this // Here pp is a field that I

Does a line contain a point

流过昼夜 提交于 2019-11-30 09:44:41
问题 I want the user to be able to drag the edges of a square around the canvas. With my current solution it works but has glitches, sometimes an edge cannot be selected. Is there a clean way to tell if a line has been clicked (e.g. passes through a coordinate)? This is how I'm currently testing: // check edge pressed, edge is the line between to // coords e.g. (i) & (i = 1) for (int i = 0; i < coords.size(); i++) { p1 = coords.get(i); if ((i + 1) > (coords.size() - 1)) p2 = coords.get(0); else p2