]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Surface.cpp
Use the density values from the environment subsystem, to properly handle
[flightgear.git] / src / FDM / YASim / Surface.cpp
index baae993b81e49346b3a58eb7b5dd20f4e895e570..c46fd55772b5f31d776c55118eb12de9e4de24f1 100644 (file)
@@ -16,6 +16,7 @@ Surface::Surface()
     _orient[3] = 0; _orient[4] = 1; _orient[5] = 0;
     _orient[6] = 0; _orient[7] = 0; _orient[8] = 1;
     
+    _chord = 0;
     _incidence = 0;
     _slatPos = _spoilerPos = _flapPos = 0;
     _slatDrag = _spoilerDrag = _flapDrag = 1;
@@ -171,10 +172,10 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
     // Airfoil lift (pre-stall and zero-alpha) torques "up" (negative
     // torque) around the Y axis, while flap lift pushes down.  Both
     // forces are considered to act at one third chord from the
-    // center.  Convert to local (i.e. airplane) coordiantes and store
+    // edge.  Convert to local (i.e. airplane) coordiantes and store
     // into "torque".
     torque[0] = 0;
-    torque[1] = 0.33 * _chord * (flapLift - (_cz*_cz0 + stallLift));
+    torque[1] = 0.1667f * _chord * (flapLift - (_cz*_cz0 + stallLift));
     torque[2] = 0;
     Math::tmul33(_orient, torque, torque);
 
@@ -190,7 +191,7 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
     Math::tmul33(_orient, out, out);
 
     // Add in the units to make a real force:
-    float scale = 0.5*rho*vel*vel*_c0;
+    float scale = 0.5f*rho*vel*vel*_c0;
     Math::mul3(scale, out, out);
     Math::mul3(scale, torque, torque);
 }
@@ -221,7 +222,7 @@ float Surface::stallFunc(float* v)
        return 1;
 
     // (note mask: we want to use the "positive" stall angle here)
-    float scale = 0.5*_peaks[fwdBak]/_stalls[i&2];
+    float scale = 0.5f*_peaks[fwdBak]/_stalls[i&2];
 
     // Before the stall
     if(alpha <= stallAlpha)