jean pellotier a écrit :
hi, yesterday we were near the Kilimanjaro (HTKJ) and up to reach the top with a c172, we tried to use the lift given by ridge lift, but it was always 0. I tried to start at Quito (SEQU) and ridge lift get elevation values only once in north hemisphere.
it seems that:

 (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(
SGGeod::fromRad(probe_lon_rad[i],probe_lat_rad[i]), 20000), elevation, 0))

in environment/ridge_lift.cxx is always false in south hemisphere, an can't report the ground elevation


The responsable was the test for the pole position, to avoid a division by cos(lat) =0, here's a patch addressing this issue, if someone can have a look and commit, thanks.

jano
Index: src/Environment/ridge_lift.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Environment/ridge_lift.cxx,v
retrieving revision 1.8
diff -u -r1.8 ridge_lift.cxx
--- src/Environment/ridge_lift.cxx	20 May 2009 09:24:56 -0000	1.8
+++ src/Environment/ridge_lift.cxx	23 May 2009 06:47:58 -0000
@@ -176,7 +176,7 @@
 
 			probe_lat_rad[i] = asin(sin(user_latitude_rad)*cos(probe_radius_ratio)
 					+cos(user_latitude_rad)*sin_probe_radius_ratio*cos(ground_wind_from_rad));
-			if (probe_lat_rad[i] < SG_EPSILON ) {
+			if (abs(abs(probe_lat_rad[i]) - SG_PI / 2.0) < SG_EPSILON ) {
 				probe_lon_rad[i] = user_latitude_rad; // probe on a pole	
 			} else {
 				probe_lon_rad[i] = fmod((user_longitude_rad+asin(sin(ground_wind_from_rad)
@@ -191,11 +191,7 @@
 			double elevation = 0;
 			if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(
 				SGGeod::fromRad(probe_lon_rad[i],probe_lat_rad[i]), 20000), elevation, 0)) {
-				if ( elevation > 0.1 ) { 
 					probe_elev_m[i] = elevation; 
-				} else { 
-					probe_elev_m[i] = 0.1 ;
-				}
 			} else { 
 				probe_elev_m[i] = 0.1;
 			}
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to