coordinates

Calculating bearing between two CLLocationCoordinate2Ds

烂漫一生 提交于 2019-11-26 08:59:31
问题 Very \"simple\" problem: given two CLLocationCoordinate2Ds, how can I get the bearing (as radians) from the first to the second? I\'ve done a lot of research and studying on this, both the general problem and Objective-C/Cocoa Touch/iOS specifically. Here\'s my implementation: - (float) getHeadingForDirectionFromCoordinate:(CLLocationCoordinate2D)fromLoc toCoordinate:(CLLocationCoordinate2D)toLoc { float fLat = fromLoc.latitude; float fLng = fromLoc.longitude; float tLat = toLoc.latitude;

How to get the x and y of a program window in Java?

蓝咒 提交于 2019-11-26 08:47:49
Is there a way for me to get the X and Y values of a window in java? I read that I'll have to use runtime, since java can't mess directly, however I am not so sure of how to do this. Can anyone point me some links/tips on how to get this? To get the x and y position of "any other unrelated application" you're going to have to query the OS and that means likely using either JNI, JNA or some other scripting utility such as AutoIt (if Windows). I recommend either JNA or the scripting utility since both are much easier to use than JNI (in my limited experience), but to use them you'll need to

Calculating the angle between two lines without having to calculate the slope? (Java)

亡梦爱人 提交于 2019-11-26 08:09:37
问题 I have two Lines: L1 and L2. I want to calculate the angle between the two lines. L1 has points: {(x1, y1), (x2, y2)} and L2 has points: {(x3, y3), (x4, y4)} . How can I calculate the angle formed between these two lines, without having to calculate the slopes? The problem I am currently having is that sometimes I have horizontal lines (lines along the x-axis) and the following formula fails (divide by zero exception): arctan((m1 - m2) / (1 - (m1 * m2))) where m1 and m2 are the slopes of line

Geographical boundaries of states/provinces -> Google Maps Polygon

青春壹個敷衍的年華 提交于 2019-11-26 07:57:16
问题 I\'m building a web application that is going to dynamically highlight certain U.S. states and Canadian provinces on a Google Map, based on buttons and click events. Plan A) Polygons My primary idea for this was to draw Polygons. For this I need lists of coordinates (latitude + longitude) of all state and province outlines (clockwise or counter-clockwise). On government websites I found all sorts of different formats (i.e. E00), but I have trouble converting these formats into a simple list

Inline labels in Matplotlib

 ̄綄美尐妖づ 提交于 2019-11-26 06:59:02
问题 In Matplotlib, it\'s not too tough to make a legend ( example_legend() , below), but I think it\'s better style to put labels right on the curves being plotted (as in example_inline() , below). This can be very fiddly, because I have to specify coordinates by hand, and, if I re-format the plot, I probably have to reposition the labels. Is there a way to automatically generate labels on curves in Matplotlib? Bonus points for being able to orient the text at an angle corresponding to the angle

Reverse Java Graphics2D scaled and rotated coordinates

試著忘記壹切 提交于 2019-11-26 06:07:59
问题 I use Graphics2D in Java to scale and rotate the picture I draw. I now want to be able to tell what the original coordinates were when I click on a certain point in the picture. So given the rotated and scaled coordinates I want to calculate the original ones. Is there a simple way to do this? 回答1: If you keep a copy of the AffineTransform you use when you paint the image, you can use AffineTransform.inverseTransform(Point2D ptSrc, Point2D ptDst) to transform a device space coordinate back to

Measuring the distance between two coordinates in PHP

五迷三道 提交于 2019-11-26 05:52:55
Hi I have the need to calculate the distance between two points having the lat and long. I would like to avoid any call to external API. I tried to implement the Haversine Formula in PHP: Here is the code: class CoordDistance { public $lat_a = 0; public $lon_a = 0; public $lat_b = 0; public $lon_b = 0; public $measure_unit = 'kilometers'; public $measure_state = false; public $measure = 0; public $error = ''; public function DistAB() { $delta_lat = $this->lat_b - $this->lat_a ; $delta_lon = $this->lon_b - $this->lon_a ; $earth_radius = 6372.795477598; $alpha = $delta_lat/2; $beta = $delta_lon

Google Maps API V3: How to get region border coordinates (polyline) data? [duplicate]

蓝咒 提交于 2019-11-26 05:27:29
问题 This question already has answers here : Google has started highlighting search areas in Pink color. Is this feature available in Google Maps API 3? (2 answers) Add “Search Area” outline onto google maps result (4 answers) Closed 4 years ago . I\'m trying to get (specified) region borders as GMaps coordinates (to form a polyline) from Google Maps. Is this possible in some way? (either from maps.google.com or my own GMaps in my own domain). Note: I know you can draw/outline regions manually

Is OpenGL coordinate system left-handed or right-handed?

我与影子孤独终老i 提交于 2019-11-26 04:05:34
问题 I am trying to understand the OpenGL coordinate system. However, some tutorials say the default coordinate system is left handed (see http://www.c-sharpcorner.com/UploadFile/jeradus/OpenGLBasics11172005014307AM/OpenGLBasics.aspx) and others say it is right handed (see http://www.falloutsoftware.com/tutorials/gl/gl0.htm). Which is correct? I understand that we can transform one to the other by mirroring but I would like to know the default coordinates. 回答1: There is some confusion here. OpenGL

Converting 3D position to 2d screen position [r69!]

雨燕双飞 提交于 2019-11-26 03:54:22
问题 I need Three.js code to convert 3D object coordinates to 2d ones in a \'div\' element so that I can place text labels where they need to be (without those labels scaling/moving/rotating along with the 3D movement). Unfortunately, all of the examples that I have seen and tried so far seem to be using obsolete functions/techniques. In my case, I believe that I am using r69 of Three.js. Here is an example of an \'older\' technique that just produces errors for me: Three.js: converting 3d