------------- Copyright (C) 1999 Anthony K. Peden (apeden@earthlink.net) -------------
This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
+ the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
- You should have received a copy of the GNU General Public License along with
+ You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
- Further information about the GNU General Public License can also be found on
+ Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include <FGFDMExec.h>
-#include <FGJSBBase.h>
-#include <math/FGMatrix33.h>
-#include <math/FGColumnVector3.h>
+#include "FGFDMExec.h"
+#include "FGJSBBase.h"
+#include "math/FGMatrix33.h"
+#include "math/FGColumnVector3.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FORCE "$Id$"
+#define ID_FORCE "$Id: FGForce.h,v 1.17 2012/04/01 17:05:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
<p>This method is where the bulk of the work gets done so calling it more than
once for the same set of native forces and moments should probably be avoided.
-Note that the moment calculations are done here as well so they should not be
+Note that the moment calculations are done here as well so they should be
retrieved after calling the GetBodyForces() method:</p>
<p><tt>vM=fgf.GetMoments();</tt> </p>
<p>Retrieval of the computed forces and moments is done as detailed above.</p>
<br>
-<blockquote>
+<pre>
<p><i>CAVEAT: If the custom system is used to compute
the wind-to-body transform, then the sign of the sideslip
angle must be reversed when calling SetAnglesToBody().
hand rule. Using the custom transform type this way
should not be necessary, as it is already provided as a built
in type (and the sign differences are correctly accounted for).</i>
- <br></p>
-</blockquote>
+ </p>
+</pre>
<h4>Use as a Base Type</h4>
<br><br></p>
@author Tony Peden
- @version $Id$
+ @version $Id: FGForce.h,v 1.17 2012/04/01 17:05:51 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
public:
/// Constructor
FGForce(FGFDMExec *FDMExec);
+ FGForce(const FGForce& force) {
+ vFn = force.vFn;
+ vXYZn = force.vXYZn;
+ ttype = force.ttype;
+ fdmex = force.fdmex;
+ }
/// Destructor
~FGForce();
- enum TransformType { tNone, tWindBody, tLocalBody, tCustom } ttype;
-
- 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; };
+ enum TransformType { tNone, tWindBody, tLocalBody, tCustom };
- inline void SetNativeMoments(double Ln,double Mn, double Nn) {
- vMn(1)=Ln;
- vMn(2)=Mn;
- vMn(3)=Nn;
- }
- inline void SetNativeMoments(FGColumnVector3 vv) { vMn = vv; }
+ virtual const FGColumnVector3& GetBodyForces(void);
- inline FGColumnVector3& GetNativeForces(void) { return vFn; }
- inline FGColumnVector3& GetNativeMoments(void) { return vMn; }
-
- FGColumnVector3& GetBodyForces(void);
-
- inline FGColumnVector3& GetMoments(void) { return vM; }
+ inline double GetBodyXForce(void) const { return vFb(eX); }
+ inline double GetBodyYForce(void) const { return vFb(eY); }
+ inline double GetBodyZForce(void) const { return vFb(eZ); }
+ inline const FGColumnVector3& GetMoments(void) const { return vM; }
// Normal point of application, JSBsim structural coords
// (inches, x +back, y +right, z +up)
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; }
+ inline void SetLocation(const FGColumnVector3& vv) { vXYZn = vv; SetActingLocation(vv);}
+ inline void SetActingLocation(const FGColumnVector3& vv) { vActingXYZn = vv; }
+
+ inline double GetLocationX( void ) const { return vXYZn(eX);}
+ inline double GetLocationY( void ) const { return vXYZn(eY);}
+ inline double GetLocationZ( void ) const { return vXYZn(eZ);}
+ inline double GetActingLocationX( void ) const { return vActingXYZn(eX);}
+ inline double GetActingLocationY( void ) const { return vActingXYZn(eY);}
+ inline double GetActingLocationZ( void ) const { return vActingXYZn(eZ);}
+ const FGColumnVector3& GetLocation(void) const { return vXYZn; }
+ const FGColumnVector3& GetActingLocation(void) const { return vActingXYZn; }
//these angles are relative to body axes, not earth!!!!!
//I'm using these because pitch, roll, and yaw are easy to visualize,
//They are in radians.
void SetAnglesToBody(double broll, double bpitch, double byaw);
- inline void SetAnglesToBody(FGColumnVector3 vv) {
+ inline void SetAnglesToBody(const FGColumnVector3& vv) {
SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
}
- 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; }
+ void UpdateCustomTransformMatrix(void);
+ void SetPitch(double pitch) {vOrient(ePitch) = pitch; UpdateCustomTransformMatrix();}
+ void SetYaw(double yaw) {vOrient(eYaw) = yaw; UpdateCustomTransformMatrix();}
+
+ double GetPitch(void) const {return vOrient(ePitch);}
+ double GetYaw(void) const {return vOrient(eYaw);}
- inline FGColumnVector3& GetAnglesToBody(void) {return vOrient;}
- inline double GetAnglesToBody(int axis) {return vOrient(axis);}
- inline FGColumnVector3& GetSense(void) { return vSense; }
+ inline const FGColumnVector3& GetAnglesToBody(void) const {return vOrient;}
+ inline double GetAnglesToBody(int axis) const {return vOrient(axis);}
inline void SetTransformType(TransformType ii) { ttype=ii; }
- inline TransformType GetTransformType(void) { return ttype; }
+ inline TransformType GetTransformType(void) const { return ttype; }
- FGMatrix33 Transform(void);
+ const FGMatrix33& Transform(void) const;
protected:
FGFDMExec *fdmex;
FGColumnVector3 vMn;
FGColumnVector3 vH;
FGColumnVector3 vOrient;
+ TransformType ttype;
+ FGColumnVector3 vXYZn;
+ FGColumnVector3 vActingXYZn;
+ FGMatrix33 mT;
private:
FGColumnVector3 vFb;
FGColumnVector3 vM;
- FGColumnVector3 vXYZn;
- FGColumnVector3 vActingXYZn;
FGColumnVector3 vDXYZ;
- FGColumnVector3 vSense;
-
- FGMatrix33 mT;
void Debug(int from);
};