INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FORCE "$Id$"
-
#include "FGFDMExec.h"
#include "FGJSBBase.h"
#include "FGMatrix33.h"
#include "FGColumnVector4.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_FORCE "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
<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>
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;
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 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,
//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; }
FGMatrix33 Transform(void);
protected:
+ FGFDMExec *fdmex;
FGColumnVector3 vFn;
FGColumnVector3 vMn;
- FGFDMExec *fdmex;
- virtual void Debug(void);
-
+ FGColumnVector3 vH;
+
private:
FGColumnVector3 vFb;
FGColumnVector3 vM;
FGColumnVector3 vXYZn;
+ FGColumnVector3 vActingXYZn;
FGColumnVector3 vDXYZ;
FGColumnVector3 vSense;
FGMatrix33 mT;
-};
+ virtual void Debug(int from);
+};
+}
#endif