Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. Double xDistance = deg2rad(x2 - x1);
  2. Double yDistance = deg2rad(y2 - y1);
  3. Double a = Math.sin(xDistance / 2) * Math.sin(xDistance / 2)
  4. + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2))
  5. * Math.sin(yDistance / 2) * Math.sin(yDistance / 2);
  6. Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  7.  
  8. double deg2rad(double deg) {
  9. return (deg * Math.PI / 180.0);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement