1
0
Fork 0

Tweak normalisation of route-path segments.

KATL -> KLAX looks correct now. Great-circles that span the 180-meridian are still rendered wrong, but that's a map projection issues, which I will fix in the next few days.
This commit is contained in:
James Turner 2013-01-01 13:49:12 +00:00
parent 0a879d3c65
commit f48ad2f20b

View file

@ -147,13 +147,13 @@ void RoutePath::interpolateGreatCircle(const SGGeod& aFrom, const SGGeod& aTo, S
return; return;
} }
lonDelta = SGMiscd::normalizeAngle2(lonDelta); lonDelta = SGMiscd::normalizeAngle(lonDelta);
int steps = static_cast<int>(fabs(lonDelta) * SG_RADIANS_TO_DEGREES * 2); int steps = static_cast<int>(fabs(lonDelta) * SG_RADIANS_TO_DEGREES * 2);
double lonStep = (lonDelta / steps); double lonStep = (lonDelta / steps);
double lon = gcFrom.getLongitudeRad() + lonStep; double lon = gcFrom.getLongitudeRad() + lonStep;
for (int s=0; s < (steps - 1); ++s) { for (int s=0; s < (steps - 1); ++s) {
lon = SGMiscd::normalizeAngle(lon);
double lat = latitudeForGCLongitude(gcFrom, gcTo, lon); double lat = latitudeForGCLongitude(gcFrom, gcTo, lon);
r.push_back(SGGeod::fromGeoc(SGGeoc::fromRadM(lon, lat, SGGeodesy::EQURAD))); r.push_back(SGGeod::fromGeoc(SGGeoc::fromRadM(lon, lat, SGGeodesy::EQURAD)));
//SG_LOG(SG_GENERAL, SG_INFO, "lon:" << lon * SG_RADIANS_TO_DEGREES << " gives lat " << lat * SG_RADIANS_TO_DEGREES); //SG_LOG(SG_GENERAL, SG_INFO, "lon:" << lon * SG_RADIANS_TO_DEGREES << " gives lat " << lat * SG_RADIANS_TO_DEGREES);