Thoughts, suggestions?
cd $flightgear_root/source/src/Time
patch < sunpos_nan.patch
- Simon.
Simon Hollier
Computer Services
Northeast Health District
Index: sunpos.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Time/sunpos.cxx,v retrieving revision 1.3 diff -r1.3 sunpos.cxx 249c249 < double dot, east_dot; --- > double dot, east_dot, ang; 345c345,348 < l->set_sun_rotation( acos(dot) ); --- > ang = acos( dot ); > // values of dot where dot = 1 + small_delta cause acos to return > NaN(not a number) > if ( isnan(ang) ) > ( dot - 0.5 > 0 ) ? ang = 0 : ang = SGD_PI; 347c350,352 < l->set_sun_rotation( -acos(dot) ); --- > ang = -acos(dot); > if ( isnan(ang) ) > ( dot - 0.5 > 0 ) ? ang = 0 : ang = -SGD_PI; 349,350c354,356 < // cout << " Sky needs to rotate = " << angle << " rads = " < // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl; --- > l->set_sun_rotation( ang ); > // cout << " Sky needs to rotate = " << ang << " rads = " > // << ang * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
Index: sunpos.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Time/sunpos.cxx,v retrieving revision 1.3 diff -r1.3 sunpos.cxx 249c249 < double dot, east_dot; --- > double dot, east_dot, ang; 345c345 < l->set_sun_rotation( acos(dot) ); --- > ang = -atan2( dot, SGD_PI / 4 ) + SGD_PI / 2; 347c347 < l->set_sun_rotation( -acos(dot) ); --- > ang = atan2( dot, SGD_PI / 4 ) - SGD_PI / 2; 349,350c349,351 < // cout << " Sky needs to rotate = " << angle << " rads = " < // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl; --- > l->set_sun_rotation( ang ); > //cout << " Sky needs to rotate = " << ang << " rads = " > // << ang * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
_______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
