Main Page Namespace List Class Hierarchy Alphabetical List Data Structures File List Namespace Members Data Fields Globals

# ExCMatrix4x4 Class Reference

`#include <ExCMatrix4x4.h>`

## Public Methods
| ExCMatrix4x4 ()
| ~ExCMatrix4x4 ()
void | SetLine (short line, float c1, float c2, float c3, float c4)
void | SetColone (short colone, float l1, float l2, float l3, float l4)
void | SetMatrix (float Matrix[16])
void | SetMatrix (float l1c1, float l1c2, float l1c3, float l1c4, float l2c1, float l2c2, float l2c3, float l2c4, float l3c1, float l3c2, float l3c3, float l3c4, float l4c1, float l4c2, float l4c3, float l4c4)
float | GetDeterminant (void)
void | LoadIdentity (void)
ExCMatrix4x4 | GetTransposee (void)
ExCMatrix4x4 | operator- (const ExCMatrix4x4 &m2)
ExCMatrix4x4 | operator+ (const ExCMatrix4x4 &m2)
ExCMatrix4x4 | operator * (const float scalar)
ExCMatrix4x4 | operator * (const ExCMatrix4x4 &m2)
## Data Fields
float | m_Matrix [16]
## Friends
std::ostream & | operator<< (std::ostream &s, const ExCMatrix4x4 &m)

## Constructor & Destructor Documentation

ExCMatrix4x4 | ( |  | ) |

| Definition at line 27 of file ExCMatrix4x4.cpp. References ExCMatrix4x4(), Guard, and LoadIdentity(). Referenced by ExCMatrix4x4(), and ~ExCMatrix4x4().
    00028 {
    00029 Guard(ExCMatrix4x4::ExCMatrix4x4())
    00030         LoadIdentity();
    00031 UnGuard
    00032 }

~ExCMatrix4x4 | ( |  | ) |

| Definition at line 34 of file ExCMatrix4x4.cpp. References ExCMatrix4x4(), and Guard.
    00035 {
    00036 Guard(ExCMatrix4x4::~ExCMatrix4x4())
    00037 UnGuard
    00038 }

## Member Function Documentation

float GetDeterminant | ( | void |  | ) |

| Definition at line 126 of file ExCMatrix4x4.cpp. References GetDeterminant(), and m_Matrix. Referenced by GetDeterminant().
    00127 {
    00128 Guard(float ExCMatrix4x4::GetDeterminant(void))
    00129 //Using Kramer rule to calculate determinant
    00130 //si deter !=0 inverse posible
    00131         return
    00132                 ((m_Matrix[5]*((m_Matrix[10]*m_Matrix[15])-(m_Matrix[11]*m_Matrix[14])))
    00133                 -(m_Matrix[9]*((m_Matrix[14]*m_Matrix[7])-(m_Matrix[6]*m_Matrix[15])))
    00134                 +(m_Matrix[13]*((m_Matrix[6]*m_Matrix[11])-(m_Matrix[7]*m_Matrix[10]))))
    00135                 -((m_Matrix[1]*((m_Matrix[10]*m_Matrix[15])-(m_Matrix[11]*m_Matrix[14])))
    00136                 -(m_Matrix[9]*((m_Matrix[14]*m_Matrix[3])-(m_Matrix[2]*m_Matrix[15])))
    00137                 +(m_Matrix[13]*((m_Matrix[6]*m_Matrix[11])-(m_Matrix[7]*m_Matrix[10]))))
    00138                 +((m_Matrix[1]*((m_Matrix[6]*m_Matrix[15])-(m_Matrix[7]*m_Matrix[14])))
    00139                 -(m_Matrix[5]*((m_Matrix[14]*m_Matrix[3])-(m_Matrix[2]*m_Matrix[15])))
    00140                 +(m_Matrix[13]*((m_Matrix[2]*m_Matrix[7])-(m_Matrix[3]*m_Matrix[6]))))
    00141                 -((m_Matrix[1]*((m_Matrix[2]*m_Matrix[7])-(m_Matrix[3]*m_Matrix[6])))
    00142                 -(m_Matrix[5]*((m_Matrix[10]*m_Matrix[3])-(m_Matrix[2]*m_Matrix[11])))
    00143                 +(m_Matrix[9]*((m_Matrix[2]*m_Matrix[7])-(m_Matrix[3]*m_Matrix[6]))));
    00144 UnGuard
    00145 }

ExCMatrix4x4 GetTransposee | ( | void |  | ) |

| Definition at line 149 of file ExCMatrix4x4.cpp. References GetTransposee(), and m_Matrix. Referenced by GetTransposee().
    00150 {
    00151 Guard(ExCMatrix4x4 ExCMatrix4x4::GetTransposee(void))
    00152         ExCMatrix4x4 result;
    00153         result.m_Matrix[0]= m_Matrix[0];
    00154         result.m_Matrix[1]= m_Matrix[4];
    00155         result.m_Matrix[2]= m_Matrix[8];
    00156         result.m_Matrix[3]= m_Matrix[12];
    00157         result.m_Matrix[4]= m_Matrix[1];
    00158         result.m_Matrix[5]= m_Matrix[5];
    00159         result.m_Matrix[6]= m_Matrix[9];
    00160         result.m_Matrix[7]= m_Matrix[13];
    00161         result.m_Matrix[8]= m_Matrix[2];
    00162         result.m_Matrix[9]= m_Matrix[6];
    00163         result.m_Matrix[10]=m_Matrix[10];
    00164         result.m_Matrix[11]=m_Matrix[14];
    00165         result.m_Matrix[12]=m_Matrix[3];
    00166         result.m_Matrix[13]=m_Matrix[7];
    00167         result.m_Matrix[14]=m_Matrix[11];
    00168         result.m_Matrix[15]=m_Matrix[15];
    00169         return result;
    00170 UnGuard
    00171 }

void LoadIdentity | ( | void |  | ) |

| Definition at line 116 of file ExCMatrix4x4.cpp. References LoadIdentity(), and m_Matrix. Referenced by ExCMatrix4x4(), and LoadIdentity().
    00117 {
    00118 Guard(void ExCMatrix4x4::LoadIdentity(void))
    00119         m_Matrix[0] =1.0f;m_Matrix[4] =0.0f;m_Matrix[8] =0.0f;m_Matrix[12]=0.0f;
    00120         m_Matrix[1] =0.0f;m_Matrix[5] =1.0f;m_Matrix[9] =0.0f;m_Matrix[13]=0.0f;
    00121         m_Matrix[2] =0.0f;m_Matrix[6] =0.0f;m_Matrix[10]=1.0f;m_Matrix[14]=0.0f;
    00122         m_Matrix[3] =0.0f;m_Matrix[7] =0.0f;m_Matrix[11]=0.0f;m_Matrix[15]=1.0f;
    00123 UnGuard
    00124 }

ExCMatrix4x4 operator * | ( | const ExCMatrix4x4 & | m2 | ) |

| Definition at line 245 of file ExCMatrix4x4.cpp. References m_Matrix.
    00246 {
    00247         ExCMatrix4x4 result;
    00248         ExCMatrix4x4 m1=*this;
    00249
    00250         result.m_Matrix[0]= (m1.m_Matrix[0]*m2.m_Matrix[0])+(m1.m_Matrix[4]*m2.m_Matrix[1])+(m1.m_Matrix[8]*m2.m_Matrix[2])+(m1.m_Matrix[12]*m2.m_Matrix[3]);
    00251         result.m_Matrix[4]= (m1.m_Matrix[0]*m2.m_Matrix[4])+(m1.m_Matrix[4]*m2.m_Matrix[5])+(m1.m_Matrix[8]*m2.m_Matrix[6])+(m1.m_Matrix[12]*m2.m_Matrix[7]);
    00252         result.m_Matrix[8]= (m1.m_Matrix[0]*m2.m_Matrix[8])+(m1.m_Matrix[4]*m2.m_Matrix[9])+(m1.m_Matrix[8]*m2.m_Matrix[10])+(m1.m_Matrix[12]*m2.m_Matrix[11]);
    00253         result.m_Matrix[12]= (m1.m_Matrix[0]*m2.m_Matrix[12])+(m1.m_Matrix[4]*m2.m_Matrix[13])+(m1.m_Matrix[8]*m2.m_Matrix[14])+(m1.m_Matrix[12]*m2.m_Matrix[15]);
    00254
    00255         result.m_Matrix[1]= (m1.m_Matrix[1]*m2.m_Matrix[0])+(m1.m_Matrix[5]*m2.m_Matrix[1])+(m1.m_Matrix[9]*m2.m_Matrix[2])+(m1.m_Matrix[13]*m2.m_Matrix[3]);
    00256         result.m_Matrix[5]= (m1.m_Matrix[1]*m2.m_Matrix[4])+(m1.m_Matrix[5]*m2.m_Matrix[5])+(m1.m_Matrix[9]*m2.m_Matrix[6])+(m1.m_Matrix[13]*m2.m_Matrix[7]);
    00257         result.m_Matrix[9]= (m1.m_Matrix[1]*m2.m_Matrix[8])+(m1.m_Matrix[5]*m2.m_Matrix[9])+(m1.m_Matrix[9]*m2.m_Matrix[10])+(m1.m_Matrix[13]*m2.m_Matrix[11]);
    00258         result.m_Matrix[13]= (m1.m_Matrix[1]*m2.m_Matrix[12])+(m1.m_Matrix[5]*m2.m_Matrix[13])+(m1.m_Matrix[9]*m2.m_Matrix[14])+(m1.m_Matrix[13]*m2.m_Matrix[15]);
    00259
    00260         result.m_Matrix[2]= (m1.m_Matrix[2]*m2.m_Matrix[0])+(m1.m_Matrix[6]*m2.m_Matrix[1])+(m1.m_Matrix[10]*m2.m_Matrix[2])+(m1.m_Matrix[14]*m2.m_Matrix[3]);
    00261         result.m_Matrix[6]= (m1.m_Matrix[2]*m2.m_Matrix[4])+(m1.m_Matrix[6]*m2.m_Matrix[5])+(m1.m_Matrix[10]*m2.m_Matrix[6])+(m1.m_Matrix[14]*m2.m_Matrix[7]);
    00262         result.m_Matrix[10]= (m1.m_Matrix[2]*m2.m_Matrix[8])+(m1.m_Matrix[6]*m2.m_Matrix[9])+(m1.m_Matrix[10]*m2.m_Matrix[10])+(m1.m_Matrix[14]*m2.m_Matrix[11]);
    00263         result.m_Matrix[14]= (m1.m_Matrix[2]*m2.m_Matrix[12])+(m1.m_Matrix[6]*m2.m_Matrix[13])+(m1.m_Matrix[10]*m2.m_Matrix[14])+(m1.m_Matrix[14]*m2.m_Matrix[15]);
    00264
    00265         result.m_Matrix[3]= (m1.m_Matrix[3]*m2.m_Matrix[0])+(m1.m_Matrix[7]*m2.m_Matrix[1])+(m1.m_Matrix[11]*m2.m_Matrix[2])+(m1.m_Matrix[15]*m2.m_Matrix[3]);
    00266         result.m_Matrix[7]= (m1.m_Matrix[3]*m2.m_Matrix[4])+(m1.m_Matrix[7]*m2.m_Matrix[5])+(m1.m_Matrix[11]*m2.m_Matrix[6])+(m1.m_Matrix[15]*m2.m_Matrix[7]);
    00267         result.m_Matrix[11]= (m1.m_Matrix[3]*m2.m_Matrix[8])+(m1.m_Matrix[7]*m2.m_Matrix[9])+(m1.m_Matrix[11]*m2.m_Matrix[10])+(m1.m_Matrix[15]*m2.m_Matrix[11]);
    00268         result.m_Matrix[15]= (m1.m_Matrix[3]*m2.m_Matrix[12])+(m1.m_Matrix[7]*m2.m_Matrix[13])+(m1.m_Matrix[11]*m2.m_Matrix[14])+(m1.m_Matrix[15]*m2.m_Matrix[15]);
    00269
    00270         return result;
    00271 }

ExCMatrix4x4 operator * | ( | const float | scalar | ) |

| Definition at line 222 of file ExCMatrix4x4.cpp. References m_Matrix.
    00223 {
    00224         ExCMatrix4x4 result;
    00225         ExCMatrix4x4 m1=*this;
    00226         result.m_Matrix[0]= m1.m_Matrix[0]*scalar;
    00227         result.m_Matrix[1]= m1.m_Matrix[1]*scalar;
    00228         result.m_Matrix[2]= m1.m_Matrix[2]*scalar;
    00229         result.m_Matrix[3]= m1.m_Matrix[3]*scalar;
    00230         result.m_Matrix[4]= m1.m_Matrix[4]*scalar;
    00231         result.m_Matrix[5]= m1.m_Matrix[5]*scalar;
    00232         result.m_Matrix[6]= m1.m_Matrix[6]*scalar;
    00233         result.m_Matrix[7]= m1.m_Matrix[7]*scalar;
    00234         result.m_Matrix[8]= m1.m_Matrix[8]*scalar;
    00235         result.m_Matrix[9]= m1.m_Matrix[9]*scalar;
    00236         result.m_Matrix[10]=m1.m_Matrix[10]*scalar;
    00237         result.m_Matrix[11]=m1.m_Matrix[11]*scalar;
    00238         result.m_Matrix[12]=m1.m_Matrix[12]*scalar;
    00239         result.m_Matrix[13]=m1.m_Matrix[13]*scalar;
    00240         result.m_Matrix[14]=m1.m_Matrix[14]*scalar;
    00241         result.m_Matrix[15]=m1.m_Matrix[15]*scalar;
    00242         return result;
    00243 }

ExCMatrix4x4 operator+ | ( | const ExCMatrix4x4 & | m2 | ) |

| Definition at line 198 of file ExCMatrix4x4.cpp. References m_Matrix.
    00199 {
    00200         ExCMatrix4x4 result;
    00201         ExCMatrix4x4 m1=*this;
    00202         result.m_Matrix[0]= m1.m_Matrix[0]+m2.m_Matrix[0];
    00203         result.m_Matrix[1]= m1.m_Matrix[1]+m2.m_Matrix[1];
    00204         result.m_Matrix[2]= m1.m_Matrix[2]+m2.m_Matrix[2];
    00205         result.m_Matrix[3]= m1.m_Matrix[3]+m2.m_Matrix[3];
    00206         result.m_Matrix[4]= m1.m_Matrix[4]+m2.m_Matrix[4];
    00207         result.m_Matrix[5]= m1.m_Matrix[5]+m2.m_Matrix[5];
    00208         result.m_Matrix[6]= m1.m_Matrix[6]+m2.m_Matrix[6];
    00209         result.m_Matrix[7]= m1.m_Matrix[7]+m2.m_Matrix[7];
    00210         result.m_Matrix[8]= m1.m_Matrix[8]+m2.m_Matrix[8];
    00211         result.m_Matrix[9]= m1.m_Matrix[9]+m2.m_Matrix[9];
    00212         result.m_Matrix[10]=m1.m_Matrix[10]+m2.m_Matrix[10];
    00213         result.m_Matrix[11]=m1.m_Matrix[11]+m2.m_Matrix[11];
    00214         result.m_Matrix[12]=m1.m_Matrix[12]+m2.m_Matrix[12];
    00215         result.m_Matrix[13]=m1.m_Matrix[13]+m2.m_Matrix[13];
    00216         result.m_Matrix[14]=m1.m_Matrix[14]+m2.m_Matrix[14];
    00217         result.m_Matrix[15]=m1.m_Matrix[15]+m2.m_Matrix[15];
    00218         return result;
    00219 }

ExCMatrix4x4 operator- | ( | const ExCMatrix4x4 & | m2 | ) |

| Definition at line 175 of file ExCMatrix4x4.cpp. References m_Matrix.
    00176 {
    00177         ExCMatrix4x4 result;
    00178         ExCMatrix4x4 m1=*this;
    00179         result.m_Matrix[0]= m1.m_Matrix[0]-m2.m_Matrix[0];
    00180         result.m_Matrix[1]= m1.m_Matrix[1]-m2.m_Matrix[1];
    00181         result.m_Matrix[2]= m1.m_Matrix[2]-m2.m_Matrix[2];
    00182         result.m_Matrix[3]= m1.m_Matrix[3]-m2.m_Matrix[3];
    00183         result.m_Matrix[4]= m1.m_Matrix[4]-m2.m_Matrix[4];
    00184         result.m_Matrix[5]= m1.m_Matrix[5]-m2.m_Matrix[5];
    00185         result.m_Matrix[6]= m1.m_Matrix[6]-m2.m_Matrix[6];
    00186         result.m_Matrix[7]= m1.m_Matrix[7]-m2.m_Matrix[7];
    00187         result.m_Matrix[8]= m1.m_Matrix[8]-m2.m_Matrix[8];
    00188         result.m_Matrix[9]= m1.m_Matrix[9]-m2.m_Matrix[9];
    00189         result.m_Matrix[10]=m1.m_Matrix[10]-m2.m_Matrix[10];
    00190         result.m_Matrix[11]=m1.m_Matrix[11]-m2.m_Matrix[11];
    00191         result.m_Matrix[12]=m1.m_Matrix[12]-m2.m_Matrix[12];
    00192         result.m_Matrix[13]=m1.m_Matrix[13]-m2.m_Matrix[13];
    00193         result.m_Matrix[14]=m1.m_Matrix[14]-m2.m_Matrix[14];
    00194         result.m_Matrix[15]=m1.m_Matrix[15]-m2.m_Matrix[15];
    00195         return result;
    00196 }

void SetColone | ( | short | colone,
|  | float | l1,
|  | float | l2,
|  | float | l3,
|  | float | l4
| ) |

| Definition at line 62 of file ExCMatrix4x4.cpp. References Guard, m_Matrix, and SetColone(). Referenced by SetColone().
    00063 {
    00064 Guard(void ExCMatrix4x4::SetColone(short colone,float l1,float l2,float l3,float l4))
    00065         switch(colone)
    00066         {
    00067                 case 1:
    00068                         m_Matrix[0] =l1;m_Matrix[1] =l2;m_Matrix[2] =l3;m_Matrix[3]=l4;
    00069                         break;
    00070                 case 2:
    00071                         m_Matrix[4] =l1;m_Matrix[5] =l2;m_Matrix[6] =l3;m_Matrix[7]=l4;
    00072                         break;
    00073                 case 3:
    00074                         m_Matrix[8] =l1;m_Matrix[9] =l2;m_Matrix[10]=l3;m_Matrix[11]=l4;
    00075                         break;
    00076                 case 4:
    00077                         m_Matrix[12] =l1;m_Matrix[13] =l2;m_Matrix[14]=l3;m_Matrix[15]=l4;
    00078                         break;
    00079         }
    00080 UnGuard
    00081 }

void SetLine | ( | short | line,
|  | float | c1,
|  | float | c2,
|  | float | c3,
|  | float | c4
| ) |

| Definition at line 41 of file ExCMatrix4x4.cpp. References Guard, m_Matrix, and SetLine(). Referenced by SetLine(), and SetMatrix().
    00042 {
    00043 Guard(void ExCMatrix4x4::SetLine(short line,float c1,float c2,float c3,float c4))
    00044         switch(line)
    00045         {
    00046                 case 1:
    00047                         m_Matrix[0] =c1;m_Matrix[4] =c2;m_Matrix[8] =c3;m_Matrix[12]=c4;
    00048                         break;
    00049                 case 2:
    00050                         m_Matrix[1] =c1;m_Matrix[5] =c2;m_Matrix[9] =c3;m_Matrix[13]=c4;
    00051                         break;
    00052                 case 3:
    00053                         m_Matrix[2] =c1;m_Matrix[6] =c2;m_Matrix[10]=c3;m_Matrix[14]=c4;
    00054                         break;
    00055                 case 4:
    00056                         m_Matrix[3] =c1;m_Matrix[7] =c2;m_Matrix[11]=c3;m_Matrix[15]=c4;
    00057                         break;
    00058         }
    00059 UnGuard
    00060 }

void SetMatrix | ( | float | l1c1,
|  | float | l1c2,
|  | float | l1c3,
|  | float | l1c4,
|  | float | l2c1,
|  | float | l2c2,
|  | float | l2c3,
|  | float | l2c4,
|  | float | l3c1,
|  | float | l3c2,
|  | float | l3c3,
|  | float | l3c4,
|  | float | l4c1,
|  | float | l4c2,
|  | float | l4c3,
|  | float | l4c4
| ) |

| Definition at line 103 of file ExCMatrix4x4.cpp. References Guard, SetLine(), and SetMatrix().
    00107 {
    00108 Guard(ExCMatrix4x4::SetMatrix(float l1c1...))
    00109         SetLine(1,l1c1,l1c2,l1c3,l1c4);
    00110         SetLine(2,l2c1,l2c2,l2c3,l2c4);
    00111         SetLine(3,l3c1,l3c2,l3c3,l3c4);
    00112         SetLine(4,l4c1,l4c2,l4c3,l4c4);
    00113 UnGuard
    00114 }

void SetMatrix | ( | float | Matrix[16] | ) |

| Definition at line 83 of file ExCMatrix4x4.cpp. References m_Matrix. Referenced by SetMatrix().
    00084 {
    00085         m_Matrix[0]= Matrix[0];
    00086         m_Matrix[1]= Matrix[4];
    00087         m_Matrix[2]= Matrix[8];
    00088         m_Matrix[3]= Matrix[12];
    00089         m_Matrix[4]= Matrix[1];
    00090         m_Matrix[5]= Matrix[5];
    00091         m_Matrix[6]= Matrix[9];
    00092         m_Matrix[7]= Matrix[13];
    00093         m_Matrix[8]= Matrix[2];
    00094         m_Matrix[9]= Matrix[6];
    00095         m_Matrix[10]=Matrix[10];
    00096         m_Matrix[11]=Matrix[14];
    00097         m_Matrix[12]=Matrix[3];
    00098         m_Matrix[13]=Matrix[7];
    00099         m_Matrix[14]=Matrix[11];
    00100         m_Matrix[15]=Matrix[15];
    00101 }

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | s,
|  | const ExCMatrix4x4 & | m
| ) | `[friend]`

| Definition at line 277 of file ExCMatrix4x4.cpp.
    00278 {
    00279 Guard(friend std::ostream& operator<<(std::ostream& s,const ExCMatrix4x4 &m))
    00280         s<<std::endl<<"|["<<m.m_Matrix[0]<<"]"<<"["<<m.m_Matrix[4]<<"]"<<"["<<m.m_Matrix[8]<<"]"<<"["<<m.m_Matrix[12]<<"]|"<<std::endl;
    00281         s<<"|["<<m.m_Matrix[1]<<"]"<<"["<<m.m_Matrix[5]<<"]"<<"["<<m.m_Matrix[9]<<"]"<<"["<<m.m_Matrix[13]<<"]|"<<std::endl;
    00282         s<<"|["<<m.m_Matrix[2]<<"]"<<"["<<m.m_Matrix[6]<<"]"<<"["<<m.m_Matrix[10]<<"]"<<"["<<m.m_Matrix[14]<<"]|"<<std::endl;
    00283         s<<"|["<<m.m_Matrix[3]<<"]"<<"["<<m.m_Matrix[7]<<"]"<<"["<<m.m_Matrix[11]<<"]"<<"["<<m.m_Matrix[15]<<"]|";
    00284         return s;
    00285 UnGuard
    00286 }

## Field Documentation

float m_Matrix[16]

| Definition at line 39 of file ExCMatrix4x4.h. Referenced by ExCComposed::Draw(), GetDeterminant(), GetMatrixFromEuler(), GetMatrixFromQuaternion(), GetTransposee(), LoadIdentity(), operator *(), operator+(), operator-(), operator<<(), SetColone(), SetLine(), and SetMatrix().

The documentation for this class was generated from the following files:

- ExCMatrix4x4.h
- ExCMatrix4x4.cpp