1
0
Fork 0
flightgear/src/FDM/JSBSim/FGColumnVector3.h

131 lines
3.9 KiB
C
Raw Normal View History

2001-10-05 20:16:16 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2001-12-07 17:10:17 +00:00
Header: FGColumnVector3.h
2001-10-05 20:16:16 +00:00
Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
Date started: Unknown
HISTORY
--------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGCOLUMNVECTOR3_H
#define FGCOLUMNVECTOR3_H
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <stdlib.h>
#ifdef FGFS
# include <math.h>
# include <simgear/compiler.h>
# include STL_STRING
# include STL_FSTREAM
# include STL_IOSTREAM
SG_USING_STD(string);
SG_USING_STD(ostream);
SG_USING_STD(istream);
SG_USING_STD(cerr);
SG_USING_STD(cout);
SG_USING_STD(endl);
2001-10-05 20:16:16 +00:00
#else
# include <string>
# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
2001-10-05 20:16:16 +00:00
# include <fstream.h>
# include <iostream.h>
# include <math.h>
2001-10-05 20:16:16 +00:00
# else
# include <fstream>
# include <iostream>
# if defined(sgi) && !defined(__GNUC__)
# include <math.h>
# else
# include <cmath>
# endif
2001-10-05 20:16:16 +00:00
using std::ostream;
using std::istream;
using std::cerr;
using std::cout;
using std::endl;
# endif
using std::string;
#endif
#include "FGJSBBase.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_COLUMNVECTOR3 "$Id$"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2003-06-03 08:46:15 +00:00
namespace JSBSim {
2001-10-05 20:16:16 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** This class implements a 3 dimensional vector.
@author Jon S. Berndt, Tony Peden, et. al.
@version $Id$
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
2001-10-05 20:16:16 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector3 : public FGJSBBase
{
public:
FGColumnVector3(void);
2001-12-07 17:10:17 +00:00
FGColumnVector3(double X, double Y, double Z);
2001-10-05 20:16:16 +00:00
FGColumnVector3(const FGColumnVector3& b);
~FGColumnVector3(void);
FGColumnVector3 operator=(const FGColumnVector3& b);
FGColumnVector3 operator*(const double scalar);
FGColumnVector3 operator*(const FGColumnVector3& V); // Cross product operator
FGColumnVector3 operator/(const double scalar);
FGColumnVector3 operator+(const FGColumnVector3& B); // must not return reference
FGColumnVector3 operator-(const FGColumnVector3& B);
void operator-=(const FGColumnVector3 &B);
void operator+=(const FGColumnVector3 &B);
void operator*=(const FGColumnVector3 &B);
void operator*=(const double scalar);
void operator/=(const double scalar);
2001-11-20 22:34:24 +00:00
FGColumnVector3& operator<<(const double ff);
2001-10-05 20:16:16 +00:00
inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
2001-11-20 22:34:24 +00:00
inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
2001-10-05 20:16:16 +00:00
2001-11-20 22:34:24 +00:00
double Magnitude(void);
2001-10-05 20:16:16 +00:00
FGColumnVector3 Normalize(void);
friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
friend ostream& operator<<(ostream& os, const FGColumnVector3& col);
inline double operator()(int m) const { return data[m]; }
inline double& operator()(int m) { return data[m]; }
2001-10-05 20:16:16 +00:00
FGColumnVector3 multElementWise(const FGColumnVector3& V);
private:
double data[4];
2001-10-05 20:16:16 +00:00
int rowCtr;
2001-12-13 04:48:34 +00:00
void Debug(int from);
2001-10-05 20:16:16 +00:00
};
}
2001-10-05 20:16:16 +00:00
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif