#include <mmatrix.h>
Public Methods | |
| MMatrix (int m = 1, int n = 1) | |
| ~MMatrix () | |
| void | set (int m, int n, GLfloat val) |
| GLfloat | get (int m, int n) |
| MMatrix | trans () |
| MMatrix | homogen () |
| MMatrix | reduce () |
| MMatrix | operator= (MMatrix m) |
| MMatrix | operator= (Vector v) |
| MMatrix | operator+ (MMatrix m) |
| MMatrix | operator- (MMatrix m) |
| MMatrix | operator * (MMatrix m) |
Public Attributes | |
| int | getM |
| int | getN |
Private Attributes | |
| int | dimM |
| int | dimN |
| GLfloat | mat [MAX_MMATRIX_M][MAX_MMATRIX_N] |
Definition at line 15 of file mmatrix.h.
00015 {
00016 public:
00017 MMatrix (int m = 1, int n = 1); // create a mathematical mxn matrix (note: m = y, n = x !)
00018 ~MMatrix ();
00019
00020 int getM;
00021 int getN;
00022
00023 void set (int m, int n, GLfloat val) ;
00024 GLfloat get (int m, int n);
00025
00026 MMatrix trans (); // I don't know the english translations of these operations
00027 MMatrix homogen (); // in german: Transponierte der Matrix, Homogenisierte Matrix und wieder reduzierte Matrix
00028 MMatrix reduce ();
00029
00030 MMatrix operator= (MMatrix m);
00031 MMatrix operator= (Vector v);
00032 MMatrix operator+ (MMatrix m);
00033 MMatrix operator- (MMatrix m);
00034 MMatrix operator* (MMatrix m);
00035
00036 private:
00037 int dimM, dimN;
00038
00039 GLfloat mat[MAX_MMATRIX_M][MAX_MMATRIX_N];
00040 }
|
Definition at line 3 of file mmatrix.cpp.
00003 {
00004 if ((dimN > 4) || (dimM > 4)) {
00005 dimN = 0;
00006 dimM = 0;
00007 } else {
00008 dimN = n;
00009 dimM = m;
00010 };
00011
00012 for (int x = 1; x <= MAX_MMATRIX_M; x++) {
00013 for (int y = 1; y <= MAX_MMATRIX_N; y++) {
00014 mat[x][y] = 0;
00015 };
00016 };
00017
00018 return;
00019 }
|
|
Definition at line 38 of file mmatrix.cpp.
00038 {
00039 if ((m < 1) || (m > MAX_MMATRIX_M) || (n < 1) || (y > MAX_MMATRIX_N)) return 0.0;
00040
00041 return mat[m][n];
00042 }
|
Definition at line 125 of file mmatrix.cpp.
00125 {
00126 if ((dimN < MAX_MMATRIX_N) && (dimM < MAX_MMATRIX_M)) {
00127 MMatrix tmp (dimM + 1, dimN + 1);
00128
00129 for (int x = 1; x <= dimM; x++) {
00130 for (int y = 1; y <= dimN; y++) {
00131 tmp.set (x, y, mat[x][y]);
00132 };
00133 };
00134
00135 tmp.set (dimM +1, dimN +1, 1);
00136 return tmp;
00137 } else {
00138 MMatrix tmp;
00139 return tmp;
00140 };
00141 }
|
Definition at line 84 of file mmatrix.cpp.
00084 {
00085 MMatrix tmp(m.getN (), dimM);
00086 float f;
00087
00088 if (dimN != m.getM ()) return tmp;
00089
00090 for (int x = 1; x <= m.getM (); x ++) {
00091 for (int y = 1; y <= dimN; y++) {
00092 f = 0;
00093 for (int z = 1; z <= dimM; z++) {
00094 f += mat[z][y] * m.get (x, z);
00095 };
00096
00097 tmp.set (x, y, f);
00098 };
00099 };
00100
00101 return tmp;
00102 }
|
Definition at line 56 of file mmatrix.cpp.
|
Definition at line 70 of file mmatrix.cpp.
|
Definition at line 116 of file mmatrix.cpp.
00116 {
00117 dimM = 1;
00118 dimN = 3;
00119
00120 mat[1][1] = v.x;
00121 mat[2][1] = v.y;
00122 mat[3][1] = v.z;
00123 }
|
|
Definition at line 143 of file mmatrix.cpp.
00143 {
00144 if ((dimM > 1) && (dimN > 1)) {
00145 MMatrix tmp (dimM - 1, dimN - 1);
00146
00147 for (int x = 1; x < dimM; x++) {
00148 for (int y = 1; y < dimN; y++) {
00149 tmp.set (x, y, mat[x][y]);
00150 };
00151 };
00152
00153 return tmp;
00154 } else {
00155 MMatrix tmp;
00156 return tmp;
00157 };
00158 }
|
|
Definition at line 44 of file mmatrix.cpp.
|
|
|
|
|
1.1.2 written by Dimitri van Heesch,
© 1997-2000