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__)
39 # include <iostream.h>
53 #include "FGJSBBase.h"
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 #define ID_COLUMNVECTOR3 "$Id$"
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 DECLARATION: FGColumnVector3
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 class FGColumnVector3 : public FGJSBBase
74 FGColumnVector3(void);
75 FGColumnVector3(double X, double Y, double Z);
76 FGColumnVector3(const FGColumnVector3& b);
77 ~FGColumnVector3(void);
79 FGColumnVector3 operator=(const FGColumnVector3& b);
81 FGColumnVector3 operator*(const double scalar);
82 FGColumnVector3 operator*(const FGColumnVector3& V); // Cross product operator
83 FGColumnVector3 operator/(const double scalar);
84 FGColumnVector3 operator+(const FGColumnVector3& B); // must not return reference
85 FGColumnVector3 operator-(const FGColumnVector3& B);
87 void operator-=(const FGColumnVector3 &B);
88 void operator+=(const FGColumnVector3 &B);
89 void operator*=(const FGColumnVector3 &B);
90 void operator*=(const double scalar);
91 void operator/=(const double scalar);
93 FGColumnVector3& operator<<(const double ff);
95 inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
96 inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
98 double Magnitude(void);
99 FGColumnVector3 Normalize(void);
101 friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
103 friend ostream& operator<<(ostream& os, const FGColumnVector3& col);
105 inline double operator()(int m) const { return data[m]; }
106 inline double& operator()(int m) { return data[m]; }
108 FGColumnVector3 multElementWise(const FGColumnVector3& V);
113 void Debug(int from);
116 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%