]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGForce.h
Updated to match changes in radiostack.[ch]xx
[flightgear.git] / src / FDM / JSBSim / FGForce.h
index c64d931491a5a43eec46a974c725e1fc3d2884bc..dfacc4a194c4f990c97a761c40c51e610a05bea7 100644 (file)
@@ -138,7 +138,7 @@ vector vFs and need to be passed to FGForce:</p>
 
 <p>Note that storing the native forces and moments outside of this class is not
 strictly necessary, overloaded SetNativeForces() and SetNativeMoments() methods
-which each accept three floats (rather than a vector) are provided and can be
+which each accept three doubles (rather than a vector) are provided and can be
 repeatedly called without incurring undue overhead. The body axes force vector
 can now be retrieved by calling:</p>
 
@@ -227,14 +227,14 @@ public:
 
   enum TransformType { tNone, tWindBody, tLocalBody, tCustom } ttype;
 
-  inline void SetNativeForces(float Fnx, float Fny, float Fnz) {
+  inline void SetNativeForces(double Fnx, double Fny, double Fnz) {
     vFn(1)=Fnx;
     vFn(2)=Fny;
     vFn(3)=Fnz;
   }
   inline void SetNativeForces(FGColumnVector3 vv) { vFn = vv; };
 
-  inline void SetNativeMoments(float Ln,float Mn, float Nn) {
+  inline void SetNativeMoments(double Ln,double Mn, double Nn) {
     vMn(1)=Ln;
     vMn(2)=Mn;
     vMn(3)=Nn;
@@ -244,23 +244,49 @@ public:
   inline FGColumnVector3& GetNativeForces(void) { return vFn; }
   inline FGColumnVector3& GetNativeMoments(void) { return vMn; }
 
-
   FGColumnVector3& GetBodyForces(void);
 
   inline FGColumnVector3& GetMoments(void) { return vM; }
 
-  //point of application, JSBsim structural coords
-  //(inches, x +back, y +right, z +up)
-  inline void SetLocation(float x, float y, float z) {
-    vXYZn(1) = x;
-    vXYZn(2) = y;
-    vXYZn(3) = z;
+  // Normal point of application, JSBsim structural coords
+  // (inches, x +back, y +right, z +up)
+  inline void SetLocation(double x, double y, double z) {
+    vXYZn(eX) = x;
+    vXYZn(eY) = y;
+    vXYZn(eZ) = z;
+    SetActingLocation(x, y, z);
+  }
+  
+  /** Acting point of application.
+      JSBsim structural coords used (inches, x +back, y +right, z +up).
+      This function sets the point at which the force acts - this may
+      not be the same as where the object resides. One area where this
+      is true is P-Factor modeling.
+      @param x acting location of force
+      @param y acting location of force
+      @param z acting location of force    */
+  inline void SetActingLocation(double x, double y, double z) {
+    vActingXYZn(eX) = x;
+    vActingXYZn(eY) = y;
+    vActingXYZn(eZ) = z;
   }
-  inline void SetLocationX(float x) {vXYZn(1) = x;}
-  inline void SetLocationY(float y) {vXYZn(2) = y;}
-  inline void SetLocationZ(float z) {vXYZn(3) = z;}
-  inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; }
+  inline void SetLocationX(double x) {vXYZn(eX) = x; vActingXYZn(eX) = x;}
+  inline void SetLocationY(double y) {vXYZn(eY) = y; vActingXYZn(eY) = y;}
+  inline void SetLocationZ(double z) {vXYZn(eZ) = z; vActingXYZn(eZ) = z;}
+  inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
+  inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
+  inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
+  inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; SetActingLocation(vv);}
+  inline void SetActingLocation(FGColumnVector3 vv) { vActingXYZn = vv; }
+  
+  inline double GetLocationX( void ) { return vXYZn(eX);}
+  inline double GetLocationY( void ) { return vXYZn(eY);}
+  inline double GetLocationZ( void ) { return vXYZn(eZ);}
+  inline double GetActingLocationX( void ) { return vActingXYZn(eX);}
+  inline double GetActingLocationY( void ) { return vActingXYZn(eY);}
+  inline double GetActingLocationZ( void ) { return vActingXYZn(eZ);}
   FGColumnVector3& GetLocation(void) { return vXYZn; }
+  FGColumnVector3& GetActingLocation(void) { return vActingXYZn; }
 
   //these angles are relative to body axes, not earth!!!!!
   //I'm using these because pitch, roll, and yaw are easy to visualize,
@@ -269,10 +295,12 @@ public:
   //are going to get confused.
   //They are in radians.
 
-  void SetAnglesToBody(float broll, float bpitch, float byaw);
-  inline void  SetAnglesToBody(FGColumnVector3 vv) { SetAnglesToBody(vv(1), vv(2), vv(3));}
+  void SetAnglesToBody(double broll, double bpitch, double byaw);
+  inline void  SetAnglesToBody(FGColumnVector3 vv) {
+    SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
+  }
 
-  inline void SetSense(float x, float y, float z) { vSense(1)=x, vSense(2)=y, vSense(3)=z; }
+  inline void SetSense(double x, double y, double z) { vSense(eX)=x, vSense(eY)=y, vSense(eZ)=z; }
   inline void SetSense(FGColumnVector3 vv) { vSense=vv; }
 
   inline FGColumnVector3& GetSense(void) { return vSense; }
@@ -283,20 +311,22 @@ public:
   FGMatrix33 Transform(void);
 
 protected:
+  FGFDMExec *fdmex;
   FGColumnVector3 vFn;
   FGColumnVector3 vMn;
   FGColumnVector3 vH;
-  FGFDMExec *fdmex;
-  virtual void Debug(void);
-
+  
 private:
   FGColumnVector3 vFb;
   FGColumnVector3 vM;
   FGColumnVector3 vXYZn;
+  FGColumnVector3 vActingXYZn;
   FGColumnVector3 vDXYZ;
   FGColumnVector3 vSense;
 
   FGMatrix33 mT;
+
+  virtual void Debug(int from);
 };
 
 #endif