1
0
Fork 0

Change the traffic manager's position calculations to use a spherical

earth model instead of WGS84. WGS84 precision is overkill for what the
traffic manager requires, and also keeps locking up while computing
course and distance for anti podal points in New Zealand vs. south west
france.
This commit is contained in:
durk 2006-12-27 10:02:13 +00:00
parent bb3d4ad3af
commit bd34d34d16

View file

@ -348,13 +348,16 @@ bool FGAISchedule::update(time_t now)
SGWayPoint current (lon, SGWayPoint current (lon,
lat, lat,
(*i)->getCruiseAlt()); (*i)->getCruiseAlt(),
SGWayPoint::SPHERICAL);
SGWayPoint user ( userLongitude, SGWayPoint user ( userLongitude,
userLatitude, userLatitude,
(*i)->getCruiseAlt()); (*i)->getCruiseAlt(),
SGWayPoint::SPHERICAL);
SGWayPoint dest ( arr->getLongitude(), SGWayPoint dest ( arr->getLongitude(),
arr->getLatitude(), arr->getLatitude(),
(*i)->getCruiseAlt()); (*i)->getCruiseAlt(),
SGWayPoint::SPHERICAL);
// We really only need distance to user // We really only need distance to user
// and course to destination // and course to destination
user.CourseAndDistance(current, &courseToUser, &distanceToUser); user.CourseAndDistance(current, &courseToUser, &distanceToUser);
@ -474,10 +477,12 @@ double FGAISchedule::getSpeed()
SGWayPoint dest ( dep->getLongitude(), SGWayPoint dest ( dep->getLongitude(),
dep->getLatitude(), dep->getLatitude(),
(*i)->getCruiseAlt()); (*i)->getCruiseAlt(),
SGWayPoint::SPHERICAL);
SGWayPoint curr ( arr->getLongitude(), SGWayPoint curr ( arr->getLongitude(),
arr->getLatitude(), arr->getLatitude(),
(*i)->getCruiseAlt()); (*i)->getCruiseAlt(),
SGWayPoint::SPHERICAL);
remainingTimeEnroute = (*i)->getArrivalTime() - (*i)->getDepartureTime(); remainingTimeEnroute = (*i)->getArrivalTime() - (*i)->getDepartureTime();
dest.CourseAndDistance(curr, &courseToDest, &distanceToDest); dest.CourseAndDistance(curr, &courseToDest, &distanceToDest);
speed = (distanceToDest*SG_METER_TO_NM) / speed = (distanceToDest*SG_METER_TO_NM) /