• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest Jul 22nd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. degreesToRadians: function(degrees) {
2.             return degrees * Math.PI / 180;
3.         },
4.         radiansToDegrees : function (radians) {
5.             return radians * (180 / Math.PI);
6.         },
7.         angleFromCoordinate : function (lat1, long1, lat2, long2) {
8.             return this.methods.angleFromCoordinate2(lat1, long1, lat2, long2);
9.             lat1  = this.methods.degreesToRadians(lat1);
10.             lat2  = this.methods.degreesToRadians(lat2);
11.             long1 = this.methods.degreesToRadians(long1);
12.             long2 = this.methods.degreesToRadians(long2);
13.             var dLon = (long2 - long1);
14.             var y = Math.sin(dLon) * Math.cos(lat2);
15.             var x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
16.             var brng = Math.atan2(y, x);
17.             brng = this.methods.radiansToDegrees(brng);
18.             brng = (brng + 360) % 360;
19.             //brng = 360 - brng; // count degrees counter-clockwise - remove to make clockwise
20.             return brng;
21.         },
22.
23. ----
24.             var y = Math.sin(lon2-lon1) * Math.cos(lat2);
25.             var x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(lon2-lon1);
26.             return Math.atan2(y, x) * 180 / Math.PI;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!

Top