FlapsOut
16 Jun 2007, 23:11
Anyone studying Physical Geometrics knows that the Earth, rather than being a bedrock hard globe in the heavens, is more like a water-balloon...constantly expanding and contracting as it rotates.
I would like to know that; If I were to calculate a 'Curve-of-the-Earth' distance calculation from, for instance:
'KIAH' to '13TE'? Would anyone have an argument against this formulae? And, if so? What argument?
In C#, BTW...
double distance = CalculateDistanceByTwoLatLngs(30.6560320034623, -96.5383015573025, 29.959241723995, -95.3403444794987);
private double CalculateDistanceByTwoLatLngs(double Latitude1, double Longitude1, double Latitude2, double Longitude2)
{
double Lat1, Lng1, Lat2, Lng2;
Lat1 = (Latitude1 * 3.141592657) / 180;
Lng1 = (Longitude1 * 3.141592657) / 180;
Lat2 = (Latitude2 * 3.141592657) / 180;
Lng2 = (Longitude2 * 3.141592657) / 180;
double distance = Math.Acos(Math.Sin(Lat1) * Math.Sin(Lat2) + Math.Cos(Lat1) * Math.Cos(Lat2) * Math.Cos(Lng2 - Lng1));
if (distance < 0)
distance += Math.PI;
distance = 3959.0 * distance; // 3959.0 being the 'Average Radius of the Earth in Miles'
return (distance);
}
Then? distance = 86.167549658405591 Miles...er, 86.17 miles.
Flaps ;)
P.S. Please do not answer with, 'Well, FSNav says...' or 'Well, FS Commander says...' :o
I would like to know that; If I were to calculate a 'Curve-of-the-Earth' distance calculation from, for instance:
'KIAH' to '13TE'? Would anyone have an argument against this formulae? And, if so? What argument?
In C#, BTW...
double distance = CalculateDistanceByTwoLatLngs(30.6560320034623, -96.5383015573025, 29.959241723995, -95.3403444794987);
private double CalculateDistanceByTwoLatLngs(double Latitude1, double Longitude1, double Latitude2, double Longitude2)
{
double Lat1, Lng1, Lat2, Lng2;
Lat1 = (Latitude1 * 3.141592657) / 180;
Lng1 = (Longitude1 * 3.141592657) / 180;
Lat2 = (Latitude2 * 3.141592657) / 180;
Lng2 = (Longitude2 * 3.141592657) / 180;
double distance = Math.Acos(Math.Sin(Lat1) * Math.Sin(Lat2) + Math.Cos(Lat1) * Math.Cos(Lat2) * Math.Cos(Lng2 - Lng1));
if (distance < 0)
distance += Math.PI;
distance = 3959.0 * distance; // 3959.0 being the 'Average Radius of the Earth in Miles'
return (distance);
}
Then? distance = 86.167549658405591 Miles...er, 86.17 miles.
Flaps ;)
P.S. Please do not answer with, 'Well, FSNav says...' or 'Well, FS Commander says...' :o