From: James Turner Date: Fri, 11 Jun 2010 16:38:43 +0000 (+0200) Subject: Fix longitude sign convention of geocentric routines X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0c8c596ee5617b787c821abc9296f0c63051f95e;p=simgear.git Fix longitude sign convention of geocentric routines (derived from the Williams aviation formulary, with W longitude +ve) --- diff --git a/simgear/math/SGGeodesy.cxx b/simgear/math/SGGeodesy.cxx index b9974f14..1d71b919 100644 --- a/simgear/math/SGGeodesy.cxx +++ b/simgear/math/SGGeodesy.cxx @@ -509,15 +509,16 @@ SGGeodesy::advanceRadM(const SGGeoc& geoc, double course, double distance, result.setLongitudeRad(geoc.getLongitudeRad()); } else { double tmp = SGMiscd::clip(sin(course) * sinDistance / cosLat, -1, 1); - double lon = SGMiscd::normalizeAngle(geoc.getLongitudeRad() - asin( tmp )); - result.setLongitudeRad(lon); + double lon = SGMiscd::normalizeAngle(-geoc.getLongitudeRad() - asin( tmp )); + result.setLongitudeRad(-lon); } } double SGGeodesy::courseRad(const SGGeoc& from, const SGGeoc& to) { - double diffLon = to.getLongitudeRad() - from.getLongitudeRad(); + //double diffLon = to.getLongitudeRad() - from.getLongitudeRad(); + double diffLon = from.getLongitudeRad() - to.getLongitudeRad(); double sinLatFrom = sin(from.getLatitudeRad()); double cosLatFrom = cos(from.getLatitudeRad());