]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/flight.hxx
Merge branch 'vivian/train' into next
[flightgear.git] / src / FDM / flight.hxx
index 4a47eeac3f0cd21870257ec580fe2564cb2ceca3..ba955145657cda7cb8cbd07253b244d0d4780d89 100644 (file)
    `FGInterface::get_Psi ()'
    `FGInterface::get_V_equiv_kts ()'
 
-   `FGInterface::get_Mass ()'
-   `FGInterface::get_I_xx ()'
-   `FGInterface::get_I_yy ()'
-   `FGInterface::get_I_zz ()'
-   `FGInterface::get_I_xz ()'
-   
    `FGInterface::get_V_north ()'
    `FGInterface::get_V_east ()'
    `FGInterface::get_V_down ()'
@@ -90,9 +84,9 @@
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <FDM/groundcache.hxx>
 
-SG_USING_STD(list);
-SG_USING_STD(vector);
-SG_USING_STD(string);
+using std::list;
+using std::vector;
+using std::string;
 
 // This is based heavily on LaRCsim/ls_generic.h
 class FGInterface : public SGSubsystem {
@@ -117,8 +111,6 @@ private:
     // next elapsed time.  This yields a small amount of temporal
     // jitter ( < dt ) but in practice seems to work well.
 
-    double remainder;          // remainder time from last run
-
     // CG position w.r.t. ref. point
     SGVec3d d_cg_rp_body_v;
 
@@ -146,9 +138,6 @@ private:
     SGGeoc geocentric_position_v;
     SGVec3d euler_angles_v;
 
-    // Inertias
-    double mass, i_xx, i_yy, i_zz, i_xz;
-
     // Normal Load Factor
     double nlf;
 
@@ -199,15 +188,6 @@ public:
     void _updateGeocentricPosition( double lat_geoc, double lon, double alt );
     void _update_ground_elev_at_pos( void );
 
-    inline void _set_Inertias( double m, double xx, double yy, 
-                             double zz, double xz)
-    {
-       mass = m;
-       i_xx = xx;
-       i_yy = yy;
-       i_zz = zz;
-       i_xz = xz;
-    }
     inline void _set_CG_Position( double dx, double dy, double dz ) {
        d_cg_rp_body_v[0] = dx;
        d_cg_rp_body_v[1] = dy;
@@ -450,13 +430,6 @@ public:
 
     // ========== Mass properties and geometry values ==========
 
-    // Inertias
-    inline double get_Mass() const { return mass; }
-    inline double get_I_xx() const { return i_xx; }
-    inline double get_I_yy() const { return i_yy; }
-    inline double get_I_zz() const { return i_zz; }
-    inline double get_I_xz() const { return i_xz; }
-
     // CG position w.r.t. ref. point
     inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
     inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
@@ -625,21 +598,13 @@ public:
     // Ground handling routines
     //////////////////////////////////////////////////////////////////////////
 
-    enum GroundType {
-      Unknown = 0, //??
-      Solid, // Whatever we will roll on with infinite load factor.
-      Water, // For the beaver ...
-      Catapult, // Carrier cats.
-      Wire // Carrier wires.
-    };
-
     // Prepare the ground cache for the wgs84 position pt_*.
     // That is take all vertices in the ball with radius rad around the
     // position given by the pt_* and store them in a local scene graph.
-    bool prepare_ground_cache_m(double ref_time, const double pt[3],
-                                double rad);
-    bool prepare_ground_cache_ft(double ref_time, const double pt[3],
-                                 double rad);
+    bool prepare_ground_cache_m(double startSimTime, double endSimTime,
+                                const double pt[3], double rad);
+    bool prepare_ground_cache_ft(double startSimTime, double endSimTime,
+                                 const double pt[3], double rad);
 
 
     // Returns true if the cache is valid.
@@ -656,38 +621,42 @@ public:
                       double end[2][3], double vel[2][3]);
   
 
-    // Return the altitude above ground below the wgs84 point pt
-    // Search for the nearest triangle to pt.
-    // Return ground properties like the ground type, the maximum load
-    // this kind kind of ground can carry, the friction factor between
-    // 0 and 1 which can be used to model lower friction with wet runways
-    // and finally the altitude above ground.
-    bool get_agl_m(double t, const double pt[3],
-                   double contact[3], double normal[3], double vel[3],
-                   int *type, double *loadCapacity,
-                   double *frictionFactor, double *agl);
-    bool get_agl_m(double t, const double pt[3],
-                       double contact[3], double normal[3], double vel[3],
-                       int *type, const SGMaterial **material,double *agl);
-    bool get_agl_ft(double t, const double pt[3],
-                    double contact[3], double normal[3], double vel[3],
-                    int *type, double *loadCapacity,
-                    double *frictionFactor, double *agl);
+    // Return the orientation and position matrix and the linear and angular
+    // velocity of that local coordinate systems origin for a given time and
+    // body id. The velocities are in the wgs84 frame at the bodys origin.
+    bool get_body_m(double t, simgear::BVHNode::Id id, double bodyToWorld[16],
+                    double linearVel[3], double angularVel[3]);
+
 
     // Return the altitude above ground below the wgs84 point pt
-    // Search for the nearest triangle to pt.
-    // Return ground properties like the ground type, a pointer to the
-    // material and finally the altitude above ground.
+    // Search for the nearest triangle to pt in downward direction.
+    // Return ground properties. The velocities are in the wgs84 frame at the
+    // contact point.
     bool get_agl_m(double t, const double pt[3], double max_altoff,
-                   double contact[3], double normal[3], double vel[3],
-                   int *type, const SGMaterial** material, double *agl);
+                   double contact[3], double normal[3], double linearVel[3],
+                   double angularVel[3], SGMaterial const*& material,
+                   simgear::BVHNode::Id& id);
     bool get_agl_ft(double t, const double pt[3], double max_altoff,
-                    double contact[3], double normal[3], double vel[3],
-                    int *type, const SGMaterial** material, double *agl);
+                    double contact[3], double normal[3], double linearVel[3],
+                    double angularVel[3], SGMaterial const*& material,
+                    simgear::BVHNode::Id& id);
     double get_groundlevel_m(double lat, double lon, double alt);
     double get_groundlevel_m(const SGGeod& geod);
 
 
+    // Return the nearest point in any direction to the point pt with a maximum
+    // distance maxDist. The velocities are in the wgs84 frame at the query
+    // position pt.
+    bool get_nearest_m(double t, const double pt[3], double maxDist,
+                       double contact[3], double normal[3], double linearVel[3],
+                       double angularVel[3], SGMaterial const*& material,
+                       simgear::BVHNode::Id& id);
+    bool get_nearest_ft(double t, const double pt[3], double maxDist,
+                        double contact[3], double normal[3],double linearVel[3],
+                        double angularVel[3], SGMaterial const*& material,
+                        simgear::BVHNode::Id& id);
+
+
     // Return 1 if the hook intersects with a wire.
     // That test is done by checking if the quad spanned by the points pt*
     // intersects with the line representing the wire.