static double geoDistance_km(double lat1, double long1, double lat2, double long2) { double _eQuatorialEarthRadius = 6371; double _d2r = (Math.PI / 180D); double dlong = (long2 - long1) * _d2r; double dlat = (lat2 - lat1) * _d2r; double a = Math.pow(Math.sin(dlat / 2D), 2D) + Math.cos(lat1 * _d2r) * Math.cos(lat2 * _d2r) * Math.pow(Math.sin(dlong / 2D), 2D); double c = 2D * Math.atan2(Math.sqrt(a), Math.sqrt(1D - a)); double d = _eQuatorialEarthRadius * c; return d; }
Began life as a copy of #1008302
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008304 |
| Snippet name: | geoDistance_km |
| Eternal ID of this version: | #1008304/5 |
| Text MD5: | 3e6f43bea96bb819138ceb8fb808b70c |
| Author: | stefan |
| Category: | javax / math |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-05-07 01:38:58 |
| Source code size: | 508 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 814 / 783 |
| Version history: | 4 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |