]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Joacim to export the inertia tensor from the command line solver.
authorandy <andy>
Wed, 10 Jan 2007 18:58:50 +0000 (18:58 +0000)
committerandy <andy>
Wed, 10 Jan 2007 18:58:50 +0000 (18:58 +0000)
src/FDM/YASim/RigidBody.hpp
src/FDM/YASim/yasim-test.cpp

index b34b5a482a1f26c182c11b31053aa19da7e74878..6e4a4ad3027cf51573b44d8dfc64b70d307e6c85 100644 (file)
@@ -97,6 +97,9 @@ public:
     // Returns the instantaneous rate of change of the angular
     // velocity, as a vector in local coordinates.
     void getAngularAccel(float* accelOut);
+    
+    // Returns the intertia tensor in a float[9] allocated by caller.
+    void getInertiaMatrix(float* inertiaOut);
 
 private:
     struct Mass { float m; float p[3]; };
index c2a5fd74240c9442f27a260659662ded2c273b4c..ebda62476ad5e81a5f4ba9fd34b9fff2e80df6b9 100644 (file)
@@ -103,6 +103,10 @@ int main(int argc, char** argv)
         float drag = 1000 * a->getDragCoefficient();
         float cg[3];
         a->getModel()->getBody()->getCG(cg);
+        a->getModel()->getBody()->recalc();
+
+        float SI_inertia[9];
+        a->getModel()->getBody()->getInertiaMatrix(SI_inertia);
         
         printf("Solution results:");
         printf("       Iterations: %d\n", a->getSolutionIterations());
@@ -111,7 +115,10 @@ int main(int argc, char** argv)
         printf("       Cruise AoA: %f\n", aoa);
         printf("   Tail Incidence: %f\n", tail);
         printf("Approach Elevator: %f\n", a->getApproachElevator());
-        printf("               CG: %.3f, %.3f, %.3f\n", cg[0], cg[1], cg[2]);
+        printf("               CG: x:%.3f, y:%.3f, z:%.3f\n\n", cg[0], cg[1], cg[2]);
+        printf("  Inertia tensor : %.3f, %.3f, %.3f\n", SI_inertia[0], SI_inertia[1], SI_inertia[2]);
+        printf("        [kg*m^2]   %.3f, %.3f, %.3f\n", SI_inertia[3], SI_inertia[4], SI_inertia[5]);
+        printf("     Origo at CG   %.3f, %.3f, %.3f\n", SI_inertia[6], SI_inertia[7], SI_inertia[8]);
     }
     delete fdm;
     return 0;