1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Header: FGTranslation.h
7 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 COMMENTS, REFERENCES, and NOTES
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 [1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
34 Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
36 [2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
38 [3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
39 NASA-Ames", NASA CR-2497, January 1975
40 [4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
41 Wiley & Sons, 1979 ISBN 0-471-03032-5
42 [5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
43 1982 ISBN 0-471-08936-2
45 The order of rotations used in this class corresponds to a 3-2-1 sequence,
46 or Y-P-R, or Z-Y-X, if you prefer.
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 #ifndef FGTRANSLATION_H
53 #define FGTRANSLATION_H
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 # include <simgear/compiler.h>
61 # ifdef SG_HAVE_STD_INCLUDES
67 # if defined(sgi) && !defined(__GNUC__)
75 #include "FGMatrix33.h"
76 #include "FGColumnVector3.h"
77 #include "FGColumnVector4.h"
79 #define ID_TRANSLATION "$Id$"
81 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
87 class FGTranslation : public FGModel {
89 FGTranslation(FGFDMExec*);
92 inline double GetUVW (int idx) const { return vUVW(idx); }
93 inline FGColumnVector3& GetUVW (void) { return vUVW; }
94 inline FGColumnVector3& GetUVWdot(void) { return vUVWdot; }
95 inline double GetUVWdot(int idx) const { return vUVWdot(idx); }
96 inline FGColumnVector3& GetAeroUVW (void) { return vAeroUVW; }
97 inline double GetAeroUVW (int idx) const { return vAeroUVW(idx); }
99 double Getalpha(void) const { return alpha; }
100 double Getbeta (void) const { return beta; }
101 inline double GetMagBeta(void) const { return fabs(beta); }
102 double Getqbar (void) const { return qbar; }
103 double GetqbarUW (void) const { return qbarUW; }
104 double GetqbarUV (void) const { return qbarUV; }
105 inline double GetVt (void) const { return Vt; }
106 double GetMach (void) const { return Mach; }
107 double Getadot (void) const { return adot; }
108 double Getbdot (void) const { return bdot; }
110 void SetUVW(FGColumnVector3 tt) { vUVW = tt; }
111 void SetAeroUVW(FGColumnVector3 tt) { vAeroUVW = tt; }
113 inline void Setalpha(double tt) { alpha = tt; }
114 inline void Setbeta (double tt) { beta = tt; }
115 inline void Setqbar (double tt) { qbar = tt; }
116 inline void SetqbarUW (double tt) { qbarUW = tt; }
117 inline void SetqbarUV (double tt) { qbarUV = tt; }
118 inline void SetVt (double tt) { Vt = tt; }
119 inline void SetMach (double tt) { Mach=tt; }
120 inline void Setadot (double tt) { adot = tt; }
121 inline void Setbdot (double tt) { bdot = tt; }
123 inline void SetAB(double t1, double t2) { alpha=t1; beta=t2; }
131 FGColumnVector3 vUVW;
132 FGColumnVector3 vUVWdot;
133 FGColumnVector3 vUVWdot_prev[3];
135 FGColumnVector3 vAeroUVW;
138 double qbar, qbarUW, qbarUV;
142 void Debug(int from);
145 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%