Advertisement
TLama

Untitled

Mar 18th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.47 KB | None | 0 0
  1. uses
  2.   Math;
  3.  
  4. procedure MidPoint(Lat1, Lon1, Lat2, Lon2: Double; out Lat3, Lon3: Double);
  5. var
  6.   Bx, By, DLon: Double;
  7. begin
  8.   DLon := DegToRad(Lon2 - Lon1);
  9.  
  10.   Lat1 := DegToRad(Lat1);
  11.   Lat2 := DegToRad(Lat2);
  12.   Lon1 := DegToRad(Lon1);
  13.  
  14.   Bx := Cos(Lat2) * Cos(DLon);
  15.   By := Cos(Lat2) * Sin(DLon);
  16.   Lat3 := RadToDeg(ArcTan2(Sin(Lat1) + Sin(Lat2), Sqrt((Cos(Lat1) + Bx) * (Cos(Lat1) + Bx) + By * By)));
  17.   Lon3 := RadToDeg(Lon1 + ArcTan2(By, Cos(Lat1) + Bx));
  18. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement