14.8 Is there a formula for calculating the direction and distance to a waypoint?
From FlightSim
VARIABLES AVGCOS 'Integral average of two cosine values DX 'W-E distance between starting and ending points in NM DY 'S-N distance between starting and ending points in NM CRS 'Straight-line course from starting to ending point DIST 'Straight-line distance between starting and ending points
'PROCEDURE If (LAT1 = LAT2) Then AVGCOS = Cos(LAT1) ElseIf (LAT1 <> LAT2) Then AVGCOS = (Sin(LAT2) - Sin(LAT1)) / (LAT2 - LAT1) End If DX = 60 * AVGCOS * (LON2 - LON1) DY = 60 * (LAT2 - LAT1) If (DX = 0 And LAT1 > LAT2) Then TCRS = 180 ElseIf (DX = 0 And LAT1 <= LAT2) Then TCRS = 0 ElseIf (DX <> 0 And LON1 > LON2) Then TCRS = 270 - Atn(DY / DX) ElseIf (DX <> 0 And LON1 <= LON2) Then TCRS = 90 - Atn(DY / DX) End If DIST = Sqr(DX * DX + DY * DY)
MDK


