From 0c8c596ee5617b787c821abc9296f0c63051f95e Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 11 Jun 2010 18:38:43 +0200 Subject: [PATCH] Fix longitude sign convention of geocentric routines (derived from the Williams aviation formulary, with W longitude +ve) --- simgear/math/SGGeodesy.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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()); -- 2.39.5