1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2017-05-16 13:18:57 +02:00
parent 5bfe9c2527
commit 4386e1f2e1

View File

@ -26,14 +26,13 @@
// Abridged Molodensky transformation // Abridged Molodensky transformation
static Coordinates toWGS84(Coordinates c, const Datum &datum) static Coordinates toWGS84(Coordinates c, const Datum &datum)
{ {
double dX = datum.dx(); double rlat = deg2rad(c.lat());
double dY = datum.dy(); double rlon = deg2rad(c.lon());
double dZ = datum.dz();
double slat = sin(deg2rad(c.lat())); double slat = sin(rlat);
double clat = cos(deg2rad(c.lat())); double clat = cos(rlat);
double slon = sin(deg2rad(c.lon())); double slon = sin(rlon);
double clon = cos(deg2rad(c.lon())); double clon = cos(rlon);
double ssqlat = slat * slat; double ssqlat = slat * slat;
double from_f = datum.ellipsoid().flattening(); double from_f = datum.ellipsoid().flattening();
@ -47,10 +46,11 @@ static Coordinates toWGS84(Coordinates c, const Datum &datum)
double rm = from_a * (1 - from_esq) / pow((1 - from_esq * ssqlat), 1.5); double rm = from_a * (1 - from_esq) / pow((1 - from_esq * ssqlat), 1.5);
double from_h = 0.0; double from_h = 0.0;
double dlat = (-dX * slat * clon - dY * slat * slon + dZ * clat + da * rn double dlat = (-datum.dx() * slat * clon - datum.dy() * slat * slon
* from_esq * slat * clat / from_a + +df * (rm * adb + rn / adb) * slat + datum.dz() * clat + da * rn * from_esq * slat * clat / from_a + df
* clat) / (rm + from_h); * (rm * adb + rn / adb) * slat * clat) / (rm + from_h);
double dlon = (-dX * slon + dY * clon) / ((rn + from_h) * clat); double dlon = (-datum.dx() * slon + datum.dy() * clon) / ((rn + from_h)
* clat);
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat)); return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
} }