Fixed calculation bug.

This commit is contained in:
Michael Wilson
2016-09-18 13:29:02 +12:00
parent 60b92d2170
commit 02b484917d
@@ -374,7 +374,7 @@ public class Airport {
*/
public double calculateDistance(Airport airport){
double distance = 0;
double dLong = this.longitude - airport.getLatitude();
double dLong = this.longitude - airport.getLongitude();
double dLat = this.latitude - airport.getLatitude();
double a = Math.pow((Math.sin(dLat/2)), 2) + Math.cos(this.latitude) * Math.cos(airport.getLatitude()) * Math.pow(Math.sin(dLong/2), 2);
double c = a * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));