Go to the documentation of this file.00001
00004 template<typename Real = RV_PRECISSION_TYPENAME>
00005 class m3x3 {
00006 public:
00007 union {
00008 struct{ Real m[3][3]; };
00009 struct{ Real m9[9]; };
00010 };
00011
00015 m3x3(){}
00016
00021 m3x3(const m3x3<Real>& mat){
00022 for(int i=0; i<3; i++)
00023 for(int j=0; j<3; j++)
00024 m[i][j] = mat(i,j);
00025 }
00026
00029 m3x3(const Real a, const Real b, const Real c,
00030 const Real d, const Real e, const Real f,
00031 const Real g, const Real h, const Real i)
00032 {
00033 m[0][0]=a; m[0][1]=b; m[0][2]=c;
00034 m[1][0]=d; m[1][1]=e; m[1][2]=f;
00035 m[2][0]=g; m[2][1]=h; m[2][2]=i;
00036 }
00037
00038 inline m3x3<Real>& zero(void);
00039 inline m3x3<Real>& identity(void);
00040 inline m3x3<Real>& transpose(void);
00041 inline m3x3<Real>& invert(void);
00042
00043 inline m3x3<Real>& set(
00044 const Real a, const Real b, const Real c,
00045 const Real d, const Real e, const Real f,
00046 const Real g, const Real h, const Real i);
00047 inline m3x3<Real>& get(
00048 Real& a, Real& b, Real& c,
00049 Real& d, Real& e, Real& f,
00050 Real& g, Real& h, Real& i);
00051
00052 inline m3x3<Real>& asRotationX(const Real angle);
00053 inline m3x3<Real>& asRotationY(const Real angle);
00054 inline m3x3<Real>& asRotationZ(const Real angle);
00055 inline m3x3<Real>& asRotation(const Real x, const Real y, const Real z);
00056 inline m3x3<Real>& asScale(const Real x, const Real y, const Real z);
00057 inline m3x3<Real>& scale(const Real x, const Real y, const Real z);
00058
00059 inline m3x3<Real>& operator = (const m3x3<Real>& a);
00060 inline m3x3<Real>& operator += (const m3x3<Real>& a);
00061 inline m3x3<Real>& operator -= (const m3x3<Real>& a);
00062 inline m3x3<Real>& operator *= (const m3x3<Real>& a);
00063 inline bool operator == (const m3x3<Real>& a);
00064 inline bool operator != (const m3x3<Real>& a);
00065
00066 inline Real* operator [] (const unsigned char i);
00067 inline const Real* operator [] (const unsigned char i) const;
00068 inline Real& operator () (const unsigned char i);
00069 inline const Real operator () (const unsigned char i) const;
00070 inline Real& operator () (const unsigned char i, const unsigned char j);
00071 inline const Real operator () (const unsigned char i, const unsigned char j) const;
00072 };
00073
00074 template<typename Real> inline m3x3<Real> Identity3x3();
00075 template<typename Real> inline m3x3<Real> Zero3x3();
00076
00077 template<typename Real> inline m3x3<Real> transpose(const m3x3<Real> m);
00078 template<typename Real> inline m3x3<Real> inverse(const m3x3<Real> m);
00079
00080 template<typename Real> inline m3x3<Real> add(const m3x3<Real>& a, const m3x3<Real>& b);
00081 template<typename Real> inline m3x3<Real> sub(const m3x3<Real>& a, const m3x3<Real>& b);
00082 template<typename Real> inline m3x3<Real> mul(const m3x3<Real>& a, const m3x3<Real>& b);
00083 template<typename Real> inline v3<Real> mul(const v3<Real>& v, const m3x3<Real>& m);
00084 template<typename Real> inline v3<Real> mul(const m3x3<Real>& m, const v3<Real>& v);
00085
00086 template<typename Real> inline v3<Real> operator * (const v3<Real>& v, const m3x3<Real>& m);
00087 template<typename Real> inline v3<Real> operator * (const m3x3<Real>& m, const v3<Real>& v);
00088 template<typename Real> inline m3x3<Real> operator * (const m3x3<Real>& a, const m3x3<Real>& b);
00089 template<typename Real> inline m3x3<Real> operator + (const m3x3<Real>& a, const m3x3<Real>& b);
00090 template<typename Real> inline m3x3<Real> operator - (const m3x3<Real>& a, const m3x3<Real>& b);
00091
00092 typedef m3x3<float> float3x3;
00093 typedef m3x3<double> double3x3;