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);
36 # if defined (sgi) && !defined(__GNUC__)
39 # include <iostream.h>
53 #include "FGJSBBase.h"
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 #define ID_COLUMNVECTOR4 "$Id$"
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 DECLARATION: FGColumnVector4
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 class FGColumnVector4 : public FGJSBBase
74 FGColumnVector4(void);
75 FGColumnVector4(double A, double B, double C, double D);
76 FGColumnVector4(const FGColumnVector4& b);
77 ~FGColumnVector4(void);
79 FGColumnVector4 operator=(const FGColumnVector4& b);
81 FGColumnVector4 operator*(const double scalar);
82 FGColumnVector4 operator/(const double scalar);
83 FGColumnVector4 operator+(const FGColumnVector4& B); // must not return reference
84 FGColumnVector4 operator-(const FGColumnVector4& B);
86 void operator-=(const FGColumnVector4 &B);
87 void operator+=(const FGColumnVector4 &B);
88 void operator*=(const double scalar);
89 void operator/=(const double scalar);
91 inline double operator()(int m) const { return data[m]; }
92 inline double& operator()(int m) { return data[m]; }
94 FGColumnVector4& operator<<(const double ff);
96 inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; data[4]=0; }
97 inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; data[4]=ff;}
99 double Magnitude(void);
100 FGColumnVector4 Normalize(void);
102 friend FGColumnVector4 operator*(const double scalar, const FGColumnVector4& A);
104 friend ostream& operator<<(ostream& os, FGColumnVector4& col);
107 FGColumnVector4 multElementWise(const FGColumnVector4& V);
112 void Debug(int from);
115 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%