1
0
Fork 0
fgdata/gui
Florent Rougon 9037441778 Fix bearing calculation in the GPS Settings dialog
Magnetic declination being "the direction of the horizontal component of
the magnetic field measured clockwise from north" according to
MagneticField(1), it must be substracted, not added, from true bearings
in order to obtain the corresponding magnetic bearings.

Example illustrating the bug:

  Start at  KSFO, open Equipment -> GPS Settings, enter KHTH as the
  destination and click on "Search". Before the bug fix, the dialog
  gives a bearing of 85, whereas the correct magnetic bearing is 58.

  Digging a bit further, the true bearings/azimuths for the shortest
  path (geodesic line) from KSFO to KHTH are approx. 71.5 at KSFO and
  73.8 at KHTH. This can be verified with two independent libraries
  (GeographicLib and PROJ.4):

    % echo "37d37'08N 122d22'30W 38d32'45N 118d38'00W" | \
      GeodSolve -i
    71.44943076 73.75785283 343987.398
    % echo "37d37'08N 122d22'30W 38d32'45N 118d38'00W" | \
      geod +ellps=WGS84 -I -f '%0.3f'
    71.449  -106.242        343987.398

  (-106.242 + 180 = 73.758: -106.242 is the "back azimuth" at KHTH for
  this path)

  The bearing of 85 given by the code in gui/dialogs/gps.xml before
  this commit is indeed 71.5 + magnetic declination at the starting
  point (KSFO), whereas it should be 71.5 - magnetic declination.

  Another, more experimental way:

  Start FlightGear with:

     fgfs --aircraft=ufo --disable-real-weather-fetch \
     '--metar=KSFO 070956Z 36000KT 10SM FEW023 11/07 A2977 RMK AO2 SLP080 T01060067' \
     --lat=37.61867421 --lon=-122.37500761 --heading=71.45931

   (just in case wind influences the ufo, I have no idea whether this is
   the case or not...)

   During your flight, progressively increase your heading (as seen in
   the HUD, i.e., true heading) so that it smoothly changes from 71.5 at
   KSFO to 73.8 at KHTH. You should arrive pretty close to KHTH, whereas
   the initial heading of 85 given by the GPS Settings dialog is way too
   high, be it interpreted as a magnetic heading (which was visibly the
   intention---it would be nice to write that in the dialog BTW) or as a
   true heading (in which case the result is even further from the
   correct value).
2015-12-08 22:46:47 +01:00
..
dialogs Fix bearing calculation in the GPS Settings dialog 2015-12-08 22:46:47 +01:00
icons/Humanity canvas.gui: Add MessageBox class. 2014-06-17 17:16:02 +02:00
images Basic window decorator with title bar and close button. 2013-06-06 23:27:11 +02:00
styles Canvas style: add missing icon 2015-11-10 13:40:49 +01:00
cursor-spin-ccw.png Placeholder cursor images. 2013-03-04 23:52:50 +00:00
cursor-spin-cw.png Placeholder cursor images. 2013-03-04 23:52:50 +00:00
menubar.xml Use Phi's map for Equipment->Browser Map 2015-06-12 12:05:38 +02:00
menubar.xml.alt Local Weather v0.85 by Thorsten Renk 2010-09-10 08:52:21 +02:00