]> git.mxchange.org Git - flightgear.git/commitdiff
- fill in probe[0] before using
authortorsten <torsten>
Thu, 11 Jun 2009 08:52:34 +0000 (08:52 +0000)
committerTim Moore <timoore@redhat.com>
Thu, 11 Jun 2009 14:05:20 +0000 (16:05 +0200)
- add a note about the mixing of SGGeoc and SGGeod

src/Environment/ridge_lift.cxx

index 821a2ca9acb44f90e9ffdfec5021b81004e06132..9e291d3a1741efcb0037f40ad62ad70b0b14cbbb 100644 (file)
@@ -163,14 +163,18 @@ void FGRidgeLift::update(double dt) {
        timer -= dt;
        if (timer <= 0.0 ) {
 
-               SGGeoc myPosition = SGGeoc::fromDegM( probe_lon_deg[0], probe_lat_deg[0], 20000.0 );
-               double ground_wind_from_rad = _surface_wind_from_deg_node->getDoubleValue() * SG_DEGREES_TO_RADIANS + SG_PI;
+               // NOTE: this mixes geocentric and geodetic calculations which give mathematically incorrect results
+               //       probably this is acceptable for calculating the ridge lift, converting from 
+               //       geodetic to geocentric coordinates is somewhat expensive
 
                // probe0 is current position
                probe_lat_deg[0] = _user_latitude_node->getDoubleValue();
                probe_lon_deg[0] = _user_longitude_node->getDoubleValue();
                probe_elev_m[0]  = _ground_elev_node->getDoubleValue() * SG_FEET_TO_METER;
 
+               SGGeoc myPosition = SGGeoc::fromDegM( probe_lon_deg[0], probe_lat_deg[0], 20000.0 );
+               double ground_wind_from_rad = _surface_wind_from_deg_node->getDoubleValue() * SG_DEGREES_TO_RADIANS + SG_PI;
+
                // compute the remaining probes
                for (int i = 1; i < sizeof(probe_lat_deg)/sizeof(probe_lat_deg[0]); i++) {
                        SGGeoc probe = myPosition.advanceRadM( ground_wind_from_rad, dist_probe_m[i] );