1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Header: FGColumnVector3.h
4 Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
8 --------------------------------------------------------------------------------
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
14 #ifndef FGCOLUMNVECTOR3_H
15 #define FGCOLUMNVECTOR3_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__) && (_COMPILER_VERSION < 740)
38 # include <iostream.h>
43 # if defined(sgi) && !defined(__GNUC__)
57 #include "FGJSBBase.h"
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 #define ID_COLUMNVECTOR3 "$Id$"
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 /** This class implements a 3 dimensional vector.
76 @author Jon S. Berndt, Tony Peden, et. al.
80 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
84 class FGColumnVector3 : public FGJSBBase
87 FGColumnVector3(void);
88 FGColumnVector3(double X, double Y, double Z);
89 FGColumnVector3(const FGColumnVector3& b);
90 ~FGColumnVector3(void);
92 FGColumnVector3 operator=(const FGColumnVector3& b);
94 FGColumnVector3 operator*(const double scalar);
95 FGColumnVector3 operator*(const FGColumnVector3& V); // Cross product operator
96 FGColumnVector3 operator/(const double scalar);
97 FGColumnVector3 operator+(const FGColumnVector3& B); // must not return reference
98 FGColumnVector3 operator-(const FGColumnVector3& B);
100 void operator-=(const FGColumnVector3 &B);
101 void operator+=(const FGColumnVector3 &B);
102 void operator*=(const FGColumnVector3 &B);
103 void operator*=(const double scalar);
104 void operator/=(const double scalar);
106 FGColumnVector3& operator<<(const double ff);
108 inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
109 inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
111 double Magnitude(void);
112 FGColumnVector3 Normalize(void);
114 friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
116 friend ostream& operator<<(ostream& os, const FGColumnVector3& col);
118 inline double operator()(int m) const { return data[m]; }
119 inline double& operator()(int m) { return data[m]; }
121 FGColumnVector3 multElementWise(const FGColumnVector3& V);
126 void Debug(int from);
129 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%