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__)
60 #include "FGColumnVector3.h"
61 #include "FGJSBBase.h"
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 #define ID_MATRIX33 "$Id$"
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 class FGColumnVector3;
77 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
81 /** Exception convenience class.
84 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 DECLARATION: MatrixException
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
88 class MatrixException : public FGJSBBase
94 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
98 /** Handles matrix math operations.
101 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
102 DECLARATION: FGMatrix33
103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
105 class FGMatrix33 : public FGJSBBase
109 FGMatrix33(int r, int c);
110 FGMatrix33(const FGMatrix33& A);
113 FGMatrix33& operator=(const FGMatrix33& A);
114 inline double operator()(unsigned int row, unsigned int col) const {return data[row][col];}
115 inline double& operator()(unsigned int row, unsigned int col) {return data[row][col];}
117 FGColumnVector3 operator*(const FGColumnVector3& Col);
119 inline unsigned int Rows(void) const { return 3; }
120 inline unsigned int Cols(void) const { return 3; }
123 void InitMatrix(void);
124 void InitMatrix(double value);
126 //friend FGMatrix33 operator*(double scalar,FGMatrix33& A);
128 FGMatrix33 operator-(const FGMatrix33& B);
129 FGMatrix33 operator+(const FGMatrix33& B);
130 FGMatrix33 operator*(const FGMatrix33& B);
131 FGMatrix33 operator*(const double scalar);
132 FGMatrix33 operator/(const double scalar);
133 FGMatrix33& operator<<(const double ff);
135 friend ostream& operator<<(ostream& os, const FGMatrix33& M);
136 friend istream& operator>>(istream& is, FGMatrix33& M);
138 void operator-=(const FGMatrix33 &B);
139 void operator+=(const FGMatrix33 &B);
140 void operator*=(const FGMatrix33 &B);
141 void operator*=(const double scalar);
142 void operator/=(const double scalar);
148 void TransposeSquare(void);
149 unsigned int rowCtr, colCtr;
150 void Debug(int from);