NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
Re: distance with atan2
From: Charles Seitz
Date: 2005 Nov 12, 14:37 -0500
From: Charles Seitz
Date: 2005 Nov 12, 14:37 -0500
If for whatever reason you cannot use Atan2, this equation will compute the great circle distance between two places on a spherical earth. Everything is expressed in radians. These are Borland Delphi (Pascal) functions and the extended data type has precision much greater than rquired for practical usage. ////////////// Great circle navigation ///////////////////// function GcDis(const Lat1, Lon1, Lat2, Lon2: Extended): Extended; begin Result := 2*ArcSin(Sqrt(Sqr(Sin((Lat1-Lat2)/2)) + Cos(Lat1)*Cos(Lat2)*Sqr(Sin((Lon1-Lon2)/2)))); end; function DegToRad(const Degrees: Extended): Extended; begin Result := Degrees*(pi/180) end; function RadToNm(const Radians: Extended): Extended; begin Result := (60*180/pi)*Radians end; --- CHAS