summaryrefslogtreecommitdiff
path: root/matrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'matrix.h')
-rw-r--r--matrix.h74
1 files changed, 41 insertions, 33 deletions
diff --git a/matrix.h b/matrix.h
index d1f5db2..a63e36a 100644
--- a/matrix.h
+++ b/matrix.h
@@ -30,51 +30,59 @@
#include "global.h"
template <class Ty> class Matrix
+{
+public:
+ Matrix()
{
- public:
- Matrix()
- {
- int a,b;
-
- for(a=0;a<3;a++)
- for(b=0;b<3;b++)
- mat[a][b]=0;
- }
+ int a,b;
- ~Matrix()
+ for(a=0;a<3;a++)
{
+ for(b=0;b<3;b++)
+ {
+ mat[a][b]=0;
+ }
}
+ }
- void identity()
- {
- int a,b;
+ ~Matrix()
+ {
+ }
- for(a=0;a<3;a++)
- for(b=0;b<3;b++)
- mat[a][b]=(a==b) ? 1:0;
- }
+ void identity()
+ {
+ int a,b;
- void set(Ty x, Ty y, Ty z)
+ for(a=0;a<3;a++)
{
- identity();
- mat[0][0]=x;
- mat[1][1]=y;
- mat[2][2]=z;
- mat[3][3]=1;
+ for(b=0;b<3;b++)
+ {
+ mat[a][b]=(a==b) ? 1:0;
+ }
}
+ }
- void get(Ty& x, Ty& y, Ty& z)
- {
- x=mat[0][0];
- y=mat[1][1];
- z=mat[2][2];
- }
+ void set(Ty x, Ty y, Ty z)
+ {
+ identity();
+ mat[0][0] = x;
+ mat[1][1] = y;
+ mat[2][2] = z;
+ mat[3][3] = 1;
+ }
+
+ void get(Ty& x, Ty& y, Ty& z)
+ {
+ x = mat[0][0];
+ y = mat[1][1];
+ z = mat[2][2];
+ }
- Matrix& operator*(Matrix<Ty>& m);
+ Matrix& operator*(Matrix<Ty>& m);
- private:
- Ty mat[4][4];
- };
+private:
+ Ty mat[4][4];
+};
#endif