Einzelnen Beitrag anzeigen

wurzelzwerg

Registriert seit: 19. Jun 2011
Ort: Ilmenau
111 Beiträge
 
Delphi XE5 Enterprise
 
#9

AW: GEO - Functions

  Alt 11. Aug 2012, 22:53
Das ist der modulo-Operator. "mod" unter Delphi.
Ja, klar. Nur in Delphi geht mod nur mit Ganzzahlen.

Ich hab das jetzt so gemacht:
Delphi-Quellcode:
procedure AddDistance(var Lat, Lon: Extended; direction, Distance: Extended);
var
  Lat1, Lon1, dist, winkel, Lat2, Lon2: Extended;
begin
  Lat1:= (Lat * PI) / 180;
  Lon1:= (Lon * PI) / 180;
  dist:= Distance / 6378388;
  winkel:= (direction * PI) / 180;
  Lat2:= arcsin(Sin(Lat1) * Cos(dist) + Cos(Lat1) * Sin(dist) * Cos(-winkel));
  if (Cos(Lat1) = 0) then
    Lon2:= Lon1
  else
  begin
     lon2:= lon1 - arcsin(sin(-winkel) * sin(dist) / cos(lat1)) + PI;
     lon2:= (lon2 - (Trunc(lon2 / (2*PI)) * (2*PI))) - PI;
  end;
  Lat:= (Lat2 * 180.0) / PI;
  Lon:= (Lon2 * 180.0) / PI;
end;
  Mit Zitat antworten Zitat