00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef GMATRIX44H
00028 #define GMATRIX44H
00029
00030 namespace GCS
00031
00032 {
00033
00034 class GVector3;
00035
00043 class GMatrix44
00044 {
00045
00046 public:
00050 union
00051 {
00055 struct
00056 {
00057 double m11, m12, m13, m14,
00058 m21, m22, m23, m24,
00059 m31, m32, m33, m34,
00060 m41, m42, m43, m44;
00061 };
00062
00067 double m[4][4];
00068
00073 double n[16];
00074 };
00075
00076 public:
00077
00081 GMatrix44();
00082
00086 GMatrix44(double _m11, double _m12, double _m13, double _m14,
00087 double _m21, double _m22, double _m23, double _m24,
00088 double _m31, double _m32, double _m33, double _m34,
00089 double _m41, double _m42, double _m43, double _m44);
00090
00094 GMatrix44(const GMatrix44& original);
00095
00096
00100 operator double* ();
00101
00102
00106 GMatrix44& loadIdentity();
00107
00108
00113 GMatrix44 multiply(double scalar) const;
00114
00119 GMatrix44 multiply(const GMatrix44& m) const;
00120
00121
00126 GVector3 transform(const GVector3& v) const;
00127
00132 GMatrix44 operator + (const GMatrix44& m) const;
00133
00134
00139 GMatrix44 operator - (const GMatrix44& m) const;
00140
00141
00146 GMatrix44 operator * (const GMatrix44& m) const;
00147
00148
00153 GMatrix44 operator * (const double scalar) const;
00154
00155
00160 inline bool operator == (const GMatrix44& m) const;
00161
00162
00167 inline bool operator != (const GMatrix44& m) const;
00168
00169
00170
00171
00172
00176 static GMatrix44 createIdentityMatrix();
00177
00181 static GMatrix44 createScaleMatrix(double scalar);
00182
00186 static GMatrix44 createScaleMatrix(const GVector3& v);
00187
00191 static GMatrix44 createTranslationMatrix(const GVector3& v);
00192
00197 static GMatrix44 createRotationAroundX(double angle_rad);
00198
00202 static GMatrix44 createRotationAroundY(double angle_rad);
00203
00207 static GMatrix44 createRotationAroundZ(double angle_rad);
00208
00213 static GMatrix44 createRotationAroundAxis(const GVector3& v, double angle_rad);
00214
00219 static GMatrix44 createFromOpenGL(float* values);
00220
00221
00222 };
00223
00224 }
00225
00226 #endif