]> git.mxchange.org Git - flightgear.git/commitdiff
Fix the startup position error. I'll leave it to Bertrand wether this is the best...
authorErik Hofman <erik@ehofman.com>
Sun, 7 Aug 2016 09:41:03 +0000 (11:41 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 22 Sep 2016 21:27:48 +0000 (23:27 +0200)
src/FDM/JSBSim/JSBSim.cxx
src/FDM/JSBSim/models/flight_control/FGAngles.cpp [changed mode: 0644->0755]

index 4e33296d182f5e34d204614e9cc54a6562d5f4c8..dae6d451515a074b2cf71f25d0bd9863194edf88 100644 (file)
@@ -1055,7 +1055,7 @@ void FGJSBsim::set_Altitude(double alt)
 {
   SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Altitude: " << alt );
 
-  if (needTrim) {
+  if (0){  // needTrim) {
     FGLocation position = fgic->GetPosition();
 
     position.SetPositionGeodetic(0.0, position.GetGeodLatitudeRad(), alt);
old mode 100644 (file)
new mode 100755 (executable)
index 4c17a07..d17914a
@@ -74,7 +74,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGAngles.cpp,v 1.4 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdSrc,"$Id: FGAngles.cpp,v 1.5 2016/07/27 22:42:47 andgi Exp $");
 IDENT(IdHdr,ID_ANGLES);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -145,7 +145,8 @@ bool FGAngles::Run(void )
   double x2 = cos(target_angle);
   double y2 = sin(target_angle);
 
-  double angle_to_heading_rad = acos(x1*x2 + y1*y2);
+  double x1x2_y1y2 = max(-1.0, min(x1*x2 + y1*y2, 1.0));
+  double angle_to_heading_rad = acos(x1x2_y1y2);
   double x1y2 = x1*y2;
   double x2y1 = x2*y1;