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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
19 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
26 # include <simgear/compiler.h>
29 # include STL_IOSTREAM
31 SG_USING_STD(ostream);
32 SG_USING_STD(istream);
38 # if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
45 # if defined(sgi) && !defined(__GNUC__)
59 #include "FGColumnVector3.h"
60 #include "FGJSBBase.h"
62 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66 #define ID_MATRIX33 "$Id$"
68 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
74 class FGColumnVector3;
76 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
80 /** Exception convenience class.
83 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 DECLARATION: MatrixException
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
87 class MatrixException : public FGJSBBase
93 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
97 /** Handles matrix math operations.
100 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
101 DECLARATION: FGMatrix33
102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
104 class FGMatrix33 : public FGJSBBase
108 FGMatrix33(int r, int c);
109 FGMatrix33(const FGMatrix33& A);
112 FGMatrix33& operator=(const FGMatrix33& A);
113 inline double operator()(unsigned int row, unsigned int col) const {return data[row][col];}
114 inline double& operator()(unsigned int row, unsigned int col) {return data[row][col];}
116 FGColumnVector3 operator*(const FGColumnVector3& Col);
118 inline unsigned int Rows(void) const { return 3; }
119 inline unsigned int Cols(void) const { return 3; }
122 void InitMatrix(void);
123 void InitMatrix(double value);
125 //friend FGMatrix33 operator*(double scalar,FGMatrix33& A);
127 FGMatrix33 operator-(const FGMatrix33& B);
128 FGMatrix33 operator+(const FGMatrix33& B);
129 FGMatrix33 operator*(const FGMatrix33& B);
130 FGMatrix33 operator*(const double scalar);
131 FGMatrix33 operator/(const double scalar);
132 FGMatrix33& operator<<(const double ff);
134 friend ostream& operator<<(ostream& os, const FGMatrix33& M);
135 friend istream& operator>>(istream& is, FGMatrix33& M);
137 void operator-=(const FGMatrix33 &B);
138 void operator+=(const FGMatrix33 &B);
139 void operator*=(const FGMatrix33 &B);
140 void operator*=(const double scalar);
141 void operator/=(const double scalar);
147 void TransposeSquare(void);
148 unsigned int rowCtr, colCtr;
149 void Debug(int from);