This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static double gpsbearing(double lat1, double long1, double lat2, double long2){ | |
double dLon= Math.toRadians(long2-long1); | |
double latA=Math.toRadians(lat1); | |
double latB=Math.toRadians(lat2); | |
double y = Math.sin(dLon) * Math.cos(latB); | |
double x = Math.cos(latA) * Math.sin(latB) - Math.sin(latA) * Math.cos(latB) * Math.cos(dLon); | |
double bearing = Math.toDegrees(Math.atan2(y, x)); | |
return bearing; | |
} |
NewerOlder