point

Retrieve a positive or a negative angle from 3 points

眉间皱痕 提交于 2019-11-29 04:51:59
I am rotating points around a center point in 2D space. The points are the center point, the old mouse position, and the new mouse position. My rotation function works fine, and I can calculate the angle perfectly. But I want to calculate a negative angle if the user is moving their mouse in a direction which should be interpreted as counter-clockwise. For example, moving the mouse toward the right (positive x-axis) should rotate clockwise if you are above (less than) the y value of the center point, but it should rotate counter-clockwise if you are actually below (greater than) the y value of

Gnuplot: How to make scatter plots with transparent points

痞子三分冷 提交于 2019-11-29 01:37:19
How can I plot an image with partial transparent scatter points just like in this picture with gnuplot? The problem is I don't know how to set the points to be transparent. Try this: set style fill transparent solid 0.35 noborder set style circle radius 0.02 plot 'test' u 1:2 with circles lc rgb "blue", \ '' u 1:2 every 100 w circles lc rgb "red" fs solid 1.0 border lt -1 which outputs As you can see, you can specify for each data set whether to use transparency and which color to use. If your data consist of two values (x and y position of the circle) you have to specify the circle's radius

Moving lat/lon text columns into a 'point' type column

◇◆丶佛笑我妖孽 提交于 2019-11-28 21:15:06
问题 I've got a table in my MySQL database called house . Within the house table, there are a couple of text columns called latitude and longitude . I've added a new column called coords , of type point - http://dev.mysql.com/doc/refman/5.0/en/gis-class-point.html How would I move the latitude and longitude values into the new coords column? 回答1: Assuming you want a SPATIAL index on this column: ALTER TABLE mytable ADD coords Point; UPDATE mytable SET coords = Point(lon, lat); ALTER TABLE mytable

Sort list of lon\\lat points, start with nearest

那年仲夏 提交于 2019-11-28 20:53:52
I have location from GPS (lon_base, lat_base). I have a list of locations (lon1, lat1|lon2, lat2|lon3, lat3...) This list is very long and is around the world. My questions are: 1. How do I get from that list only the lon\lat that are 1 mile from my lon_base\lat_base? 2. How do I sort them from closest to farthest? Thanks in advance! You want to define your own Comparator that, in general, looks something like this: LonLat myHouse = /* whatever */ ; Comparable comp = new Comparable () { LonLat a; int compareTo (Object b) { int aDist = calcDistance(a, myHouse) ; int bDist = calcDistance(b,

Rotate a point around a point with OpenCV

雨燕双飞 提交于 2019-11-28 20:38:06
Does anyone know how I can rotate a point around another in OpenCV? I am looking for a function like this: Point2f rotatePoint(Point2f p1, Point2f center, float angle) { /* MAGIC */ } Adrian These are the steps needed to rotate a point around another point by an angle alpha: Translate the point by the negative of the pivot point Rotate the point using the standard equation for 2-d (or 3-d) rotation Translate back The standard equation for rotation is: x' = x cos(alpha) - y sin(alpha) y' = x sin(alpha) + y cos(alpha) Let's take the example of Point(15,5) around Point(2,2) by 45 degrees. Firstly

mongodb check if point is in polygon

旧街凉风 提交于 2019-11-28 20:29:36
mongo 2.6 I have some amount of stored polygons. And I have a point. I what to know if this point fits any of stored polygons document example { ..., "polygons" : [ [ 17.60083012593064, 78.18557739257812 ], [ 17.16834652544664, 78.19381713867188 ], [ 17.17490690610013, 78.739013671875 ], [ 17.613919673106714, 78.73489379882812 ] ], ... } There is nearly the same question already Mongodb : Check if a point is inside a stored polygon . But it is not working for me - this query has to give at least one result(the one in example) - but it does not. db.areas.find( { polygons : { $geoIntersects : {

Distance of point feature to nearest polygon in R

拥有回忆 提交于 2019-11-28 19:55:05
I working on a project at the moment, where I have a point feature -- the point feature includes a 142 points -- and multiple polygon (around 10). I want to calculate the distance between every single point and the nearest polygon feature in R. My current approach is tedious and a bit long winded. I am currently planning to calculate the distance between every single point and every single polygon. For example, I would calculate the distance between the 142 points and Polygon A, the distance between the 142 points and Polygon B, the distance between 142 points and Polygon C, etc. Here is a

Finding translation and scale on two sets of points to get least square error in their distance?

人盡茶涼 提交于 2019-11-28 17:19:44
I have two sets of 3D points (original and reconstructed) and correspondence information about pairs - which point from one set represents the second one. I need to find 3D translation and scaling factor which transforms reconstruct set so the sum of square distances would be least (rotation would be nice too, but points are rotated similarly, so this is not main priority and might be omitted in sake of simplicity and speed). And so my question is - is this solved and available somewhere on the Internet? Personally, I would use least square method, but I don't have much time (and although I'm

Java: getting a value from an array from a defined location

余生颓废 提交于 2019-11-28 14:36:00
I have an array of numbers and would like to retrieve one of the values from location "index". I've looked at the Java documentation http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Array.html but my code still isn't compiling. here is my method: public class ConvexPolygon implements Shape { java.awt.Point[] vertices; public ConvexPolygon(java.awt.Point[] vertices) { this.vertices = vertices; this.color = color; this.filled = filled; } java.awt.Point getVertex(int index) { Point vertex; vertex = get(Point vertices, int index); } I have numbers in an array representing Points. The

Unable to display only the points within a specific range (circle) using the .getBounds() function (Leaflet)

丶灬走出姿态 提交于 2019-11-28 14:32:52
I am trying to display a certain amount of points within a specific range, that is within a circle . But when using the .getBounds() function for comparison to see whether the point is within the bound, i get some points outside it as shown in the screenshot below: Map Screenshot The code currently using to check if the point is within the circle bound is below: echo ' var mark = L.marker([' . $r->coordinates[0]->longitude . ',' . $r->coordinates[0]->latitude . ']); if(circle.getBounds().contains(mark.getLatLng())){ mark.addTo(map); mark.bindPopup("'.$info.'"); } '; I am looping into an array