]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Maik adds user-settable scaling constants for per-axis fuselage drag and...
authorandy <andy>
Mon, 18 Dec 2006 21:22:20 +0000 (21:22 +0000)
committerandy <andy>
Mon, 18 Dec 2006 21:22:20 +0000 (21:22 +0000)
src/FDM/YASim/Airplane.cpp
src/FDM/YASim/Airplane.hpp
src/FDM/YASim/FGFDM.cpp

index 30bdf59f34490893e4e9a8d90d4c2bf0f154627f..067e092b5c0a328baaad2841170fd6985395cba1 100644 (file)
@@ -279,7 +279,8 @@ void Airplane::addVStab(Wing* vstab)
 }
 
 void Airplane::addFuselage(float* front, float* back, float width,
-                           float taper, float mid)
+                           float taper, float mid, 
+                           float cx, float cy, float cz, float idrag)
 {
     Fuselage* f = new Fuselage();
     int i;
@@ -290,6 +291,10 @@ void Airplane::addFuselage(float* front, float* back, float width,
     f->width = width;
     f->taper = taper;
     f->mid = mid;
+    f->_cx=cx;
+    f->_cy=cy;
+    f->_cz=cz;
+    f->_idrag=idrag;
     _fuselages.add(f);
 }
 
@@ -519,9 +524,10 @@ float Airplane::compileFuselage(Fuselage* f)
         Surface* s = new Surface();
         s->setPosition(pos);
        float sideDrag = len/wid;
-        s->setYDrag(sideDrag);
-        s->setZDrag(sideDrag);
-        s->setTotalDrag(scale*segWgt);
+        s->setYDrag(sideDrag*f->_cy);
+        s->setZDrag(sideDrag*f->_cz);
+        s->setTotalDrag(scale*segWgt*f->_cx);
+        s->setInducedDrag(f->_idrag);
 
         // FIXME: fails for fuselages aligned along the Y axis
         float o[9];
index ad8b2c13e1678c6574e3f9337bff75cdb91dd56b..3da23219696556e21e559e1e195df0924545d110 100644 (file)
@@ -37,7 +37,8 @@ public:
     void addVStab(Wing* vstab);
 
     void addFuselage(float* front, float* back, float width,
-                     float taper=1, float mid=0.5);
+                     float taper=1, float mid=0.5,
+                     float cx=1, float cy=1, float cz=1, float idrag=1);
     int addTank(float* pos, float cap, float fuelDensity);
     void addGear(Gear* g);
     void addHook(Hook* h);
@@ -92,7 +93,7 @@ public:
 private:
     struct Tank { float pos[3]; float cap; float fill;
                  float density; int handle; };
-    struct Fuselage { float front[3], back[3], width, taper, mid; };
+    struct Fuselage { float front[3], back[3], width, taper, mid, _cx, _cy, _cz, _idrag; };
     struct GearRec { Gear* gear; Surface* surf; float wgt; };
     struct ThrustRec { Thruster* thruster;
                       int handle; float cg[3]; float mass; };
index bb46bff876494da25ebff2168a39c58a1302ff12..625653df382596da07683c9ed7b6fb1dc3831201 100644 (file)
@@ -316,7 +316,12 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts)
        b[2] = attrf(a, "bz");
         float taper = attrf(a, "taper", 1);
         float mid = attrf(a, "midpoint", 0.5);
-       _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid);
+        float cx = attrf(a, "cx", 1);
+        float cy = attrf(a, "cy", 1);
+        float cz = attrf(a, "cz", 1);
+       float idrag = attrf(a, "idrag", 1);
+       _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid, 
+            cx, cy, cz, idrag);
     } else if(eq(name, "tank")) {
        v[0] = attrf(a, "x");
        v[1] = attrf(a, "y");