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 FGCOLUMNVECTOR4_H
17 #define FGCOLUMNVECTOR4_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 "FGJSBBase.h"
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 #define ID_COLUMNVECTOR4 "$Id$"
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 DECLARATION: FGColumnVector4
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
73 class FGColumnVector4 : public FGJSBBase
76 FGColumnVector4(void);
77 FGColumnVector4(int m);
78 FGColumnVector4(const FGColumnVector4& b);
79 ~FGColumnVector4(void);
81 FGColumnVector4 operator=(const FGColumnVector4& b);
83 FGColumnVector4 operator*(const double scalar);
84 //FGColumnVector4 operator*(const FGColumnVector4& V); // Cross product operator
85 FGColumnVector4 operator/(const double scalar);
86 FGColumnVector4 operator+(const FGColumnVector4& B); // must not return reference
87 FGColumnVector4 operator-(const FGColumnVector4& B);
89 void operator-=(const FGColumnVector4 &B);
90 void operator+=(const FGColumnVector4 &B);
91 //void operator*=(const FGColumnVector4 &B);
92 void operator*=(const double scalar);
93 void operator/=(const double scalar);
95 inline double operator()(int m) const { return data[m]; }
96 inline double& operator()(int m) { return data[m]; }
98 FGColumnVector4& 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 FGColumnVector4 Normalize(void);
106 friend FGColumnVector4 operator*(const double scalar, const FGColumnVector4& A);
108 friend ostream& operator<<(ostream& os, FGColumnVector4& col);
111 FGColumnVector4 multElementWise(const FGColumnVector4& V);
119 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%