1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
8 --------------------------------------------------------------------------------
10 03/16/2000 JSB Added exception throwing
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
16 #ifndef FGCOLUMNVECTOR3_H
17 #define FGCOLUMNVECTOR3_H
19 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
26 # include <simgear/compiler.h>
29 # include STL_IOSTREAM
31 # if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
32 SG_USING_STD(ostream);
33 SG_USING_STD(istream);
40 # if defined(sgi) && !defined(__GNUC__)
43 # include <iostream.h>
57 #include "FGMatrix33.h"
58 #include "FGJSBBase.h"
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64 #define ID_COLUMNVECTOR3 "$Id$"
66 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
72 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 DECLARATION: FGColumnVector3
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
76 class FGColumnVector3 : public FGJSBBase
79 FGColumnVector3(void);
80 FGColumnVector3(int m);
81 FGColumnVector3(const FGColumnVector3& b);
82 ~FGColumnVector3(void);
84 FGColumnVector3 operator=(const FGColumnVector3& b);
86 FGColumnVector3 operator*(const double scalar);
87 FGColumnVector3 operator*(const FGColumnVector3& V); // Cross product operator
88 FGColumnVector3 operator/(const double scalar);
89 FGColumnVector3 operator+(const FGColumnVector3& B); // must not return reference
90 FGColumnVector3 operator-(const FGColumnVector3& B);
92 void operator-=(const FGColumnVector3 &B);
93 void operator+=(const FGColumnVector3 &B);
94 void operator*=(const FGColumnVector3 &B);
95 void operator*=(const double scalar);
96 void operator/=(const double scalar);
98 FGColumnVector3& operator<<(const double ff);
100 inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
101 inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
103 double Magnitude(void);
104 FGColumnVector3 Normalize(void);
106 friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
107 //friend FGColumnVector3 operator*(const FGMatrix33& M, FGColumnVector3& V);
109 friend ostream& operator<<(ostream& os, const FGColumnVector3& col);
111 inline double operator()(int m) const { return data[m]; }
112 inline double& operator()(int m) { return data[m]; }
114 FGColumnVector3 multElementWise(const FGColumnVector3& V);
122 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%