coordinates

How to determine if a point is within a quadrilateral

我是研究僧i 提交于 2019-11-29 03:32:27
Goal I want to determine if a test point is within a defined quadrilateral. I'm probably going to implement the solution in Matlab so I only need pseudo-code. Inputs Corners of quadrilateral : (x1,y1) (x2,y2) (x3,y3) (x4,y4) Test point : (xt, yt) Output 1 - If within quadrilateral 0 - Otherwise Update It was pointed out that identifying the vertices of the quadrilateral is not enough to uniquely identify it. You can assume that the order of the points determines the sides of the quadrilateral (point 1 connects 2, 2 connects to 3, 3 connects to 4, 4 connects to 1) Use inpolygon . Usage would be

transform longitude latitude into meters

夙愿已清 提交于 2019-11-29 03:21:56
问题 I need a function that maps gps positions to x/y values like this: getXYpos(GeoPoint relativeNullPoint, GeoPoint p){ deltaLatitude=p.latitude-relativeNullPoint.latitude; deltaLongitude=p.longitude-relativeNullPoint.longitude; ... resultX=latitude (or west to east) distance in meters from p to relativeNullPoint resultY=longitude (or south to north) distance in meters from p to relativeNullPoint } i have seen some implementations of "distance of two geoPoints" but they all just calculate the

How do I calculate the distance between two points of latitude and longitude? [duplicate]

自作多情 提交于 2019-11-29 02:56:24
问题 This question already has an answer here: Distance between two coordinates with CoreLocation 4 answers i have latitude and longitude of particular place and i want to calculate the distance so how can i calculate it? 回答1: CLLocation *location1 = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1]; CLLocation *location2 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; NSLog(@"Distance i meters: %f", [location1 distanceFromLocation:location2]); [location1 release];

WPF: Converting between screen coordinates and WPF coordinates

北战南征 提交于 2019-11-29 02:52:35
问题 I understand that WPF coordinates are different from "real" screen coodinates (pixel coordinates) if the computer is not using the default DPI setting. In my program I want to (1) figure out which monitor a WPF window is on and (2) open another window in the bottom-left corner of the same monitor. I heard there is no equivalent of Screen for WPF so I use the WinForms version, as follows, which works fine at the default 96 DPI: public void ChooseInitialPosition(Window w) // w is some other

Crossing axis and labels in matlab

别说谁变了你拦得住时间么 提交于 2019-11-29 02:26:13
I just can't find it. How to set up axis and labels in matlab so they cross at zero point, with the labels just below the axis not on left/bottom of the plot ? If I didn't make myself clear - I just want the plot to look like like we all used to draw it when in school. Axes crossing, 4 quadrants, labels right below axis, curve ... as it goes. Anyone knows how to set it up ? You should check out two submissions on The MathWorks File Exchange : PlotAxisAtOrigin by Shanrong Zhang axescenter by Matt Fig Hopefully these will work with whatever MATLAB version you have (the submission from Matt Fig

Android sqlite sort on calculated column (co-ordinates distance)

╄→尐↘猪︶ㄣ 提交于 2019-11-29 00:30:39
I am using an SQLITE database to store latitudes and longitudes of locations. I want to be able to sort the results by rough distance from the current location. I already have the current location of the device as a double (lat, lng), the lat and lng in the database are also doubles. What I want is a query that will create a virtual column that I am able to sort the results by. I currently use a function to show the distance for a selected record: float pk = (float) (180/3.14159); float a1 = (float) (db_lat / pk); float a2 = (float) (db_lon / pk); float b1 = (float) (current_lat / pk); float

PHP: Format Latitude and Longitude with degrees, minuets and seconds

那年仲夏 提交于 2019-11-29 00:15:47
How can I convert this: 26.72773551940918 Into something like this: 22°12'42"N The trick here is that the coordinates are, actually Latitude and Longitude, I just need to format them correctly. You can find functions to do that here <?php function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return $deg+((($min*60)+($sec))/3600); } function DECtoDMS($dec) { // Converts decimal longitude / latitude to DMS // ( Degrees / minutes / seconds ) // This is the piece of code which may appear to // be inefficient, but to avoid

How can i calculate the distance between two gps points in Java?

我怕爱的太早我们不能终老 提交于 2019-11-28 22:29:09
问题 I used this code but it doesnt work: Need the distance between two gps coordinates like 41.1212, 11.2323 in kilometers (Java) double d2r = (180 / Math.PI); double distance = 0; try{ double dlong = (endpoint.getLon() - startpoint.getLon()) * d2r; double dlat = (endpoint.getLat() - startpoint.getLat()) * d2r; double a = Math.pow(Math.sin(dlat / 2.0), 2) + Math.cos(startpoint.getLat() * d2r) * Math.cos(endpoint.getLat() * d2r) * Math.pow(Math.sin(dlong / 2.0), 2); double c = 2 * Math.atan2(Math

Finding a set of coordinates within a certain range from latitude and longitide

╄→гoц情女王★ 提交于 2019-11-28 22:10:30
I am working on a project in javascript involving google maps. The goal is to figure out 16-20 coordinate points within n kilometers from a set of latitude longitude coordinates such that the 16 points if connected will form a circle around the original coordinates. The end goal is to make it so I can figure out coordinates to plot and connect on google maps to make a circle around a given set of coordinates. The code would go something like: var coordinates = Array(); function findCoordinates(lat, long, range) { } coordinates = findCoordinates(-20, 40, 3); Now to make the magic happen in the

How to get coordinates (CGRect) for the selected text in UIWebView?

爱⌒轻易说出口 提交于 2019-11-28 21:26:12
I have simple UIWebView with loaded html. I want to show the PopoverView pointed to the selected text. I can get the menuFrame of the UIMenuController and use its rect, but the result isn't as accurate at the corners of the screen as I need. I can calculate the screen size and get menuFrame rect and then I can suppose where the selection may be found, but I want exactly know where is the selected text. Is it generally possible? hwaxxer You can use the javascript function getBoundingClientRect() on the range object of the selected text. This is how I do it: function getRectForSelectedText() {