1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Header: FGColumnVector4.h
4 Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
8 --------------------------------------------------------------------------------
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
14 #ifndef FGCOLUMNVECTOR4_H
15 #define FGCOLUMNVECTOR4_H
17 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
24 # include <simgear/compiler.h>
27 # include STL_IOSTREAM
29 SG_USING_STD(ostream);
30 SG_USING_STD(istream);
34 // SG_USING_STD(sqrt);
37 # if defined (sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
39 # include <iostream.h>
43 # if defined (sgi) && !defined(__GNUC__)
59 #include "FGJSBBase.h"
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
65 #define ID_COLUMNVECTOR4 "$Id$"
67 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
77 /** This class implements a 4 dimensional vector.
78 @author Jon S. Berndt, Tony Peden, et. al.
82 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
86 class FGColumnVector4 : public FGJSBBase
89 FGColumnVector4(void);
90 FGColumnVector4(double A, double B, double C, double D);
91 FGColumnVector4(const FGColumnVector4& b);
92 ~FGColumnVector4(void);
94 FGColumnVector4 operator=(const FGColumnVector4& b);
96 FGColumnVector4 operator*(const double scalar);
97 FGColumnVector4 operator/(const double scalar);
98 FGColumnVector4 operator+(const FGColumnVector4& B); // must not return reference
99 FGColumnVector4 operator-(const FGColumnVector4& B);
101 void operator-=(const FGColumnVector4 &B);
102 void operator+=(const FGColumnVector4 &B);
103 void operator*=(const double scalar);
104 void operator/=(const double scalar);
106 inline double operator()(int m) const { return data[m]; }
107 inline double& operator()(int m) { return data[m]; }
109 FGColumnVector4& operator<<(const double ff);
111 inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; data[4]=0; }
112 inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; data[4]=ff;}
114 double Magnitude(void);
115 FGColumnVector4 Normalize(void);
117 friend FGColumnVector4 operator*(const double scalar, const FGColumnVector4& A);
119 friend ostream& operator<<(ostream& os, FGColumnVector4& col);
122 FGColumnVector4 multElementWise(const FGColumnVector4& V);
127 void Debug(int from);
130 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%