tgMatrix3.cpp
Go to the documentation of this file.
00001 //CPP:
00002 //                      Title:                  class tgMatrix3
00003 //                      File:                           tgMatrix3.cpp
00004 //
00005 //                      Function:               tgMatrix3 with all necessary operations 
00006 //
00007 //                      Author:                 Thomas M�rwald
00008 //                      Date:                           20.09.2007
00009 // ----------------------------------------------------------------------------
00010 #include <blort/TomGine/tgMatrix3.h>
00011 
00012 using namespace TomGine;
00013 
00014 tgMatrix3::tgMatrix3(){
00015         for(int i=0; i<9; i++)
00016                 m[i] = 0.0f;
00017 }
00018 
00019 tgMatrix3::tgMatrix3(tgVector3 x, tgVector3 y, tgVector3 z){
00020         m[0] = x.x;     m[1] = y.x;     m[2] = z.x;
00021         m[3] = x.y; m[4] = y.y; m[5] = z.y;
00022         m[6] = x.z; m[7] = y.z; m[8] = z.z;
00023 }
00024 
00025 tgMatrix3::tgMatrix3(const tgMatrix3 &m1){
00026         m[0]=m1.m[0];   m[1]=m1.m[1];   m[2]=m1.m[2];
00027         m[3]=m1.m[3];   m[4]=m1.m[4];   m[5]=m1.m[5];
00028         m[6]=m1.m[6];   m[7]=m1.m[7];   m[8]=m1.m[8];
00029 }
00030 
00031 tgMatrix3::tgMatrix3(   float m0, float m1, float m2,
00032                                         float m3, float m4, float m5,
00033                                         float m6, float m7, float m8){
00034         m[0]=m0; m[1]=m1; m[2]=m2;
00035         m[3]=m3; m[4]=m4; m[5]=m5;
00036         m[6]=m6; m[7]=m7; m[8]=m8;
00037 
00038 }
00039 
00040 tgMatrix3 tgMatrix3::operator+(tgMatrix3 m1){
00041         tgMatrix3 m2;
00042         return m2;
00043 }
00044 
00045 tgMatrix3 tgMatrix3::operator-(tgMatrix3 m1){
00046         tgMatrix3 m2;
00047         return m2;
00048 }
00049 
00050 tgMatrix3 tgMatrix3::operator*(tgMatrix3 m1){
00051         tgMatrix3 m2;
00052         
00053         m2.m[0] = m[0]*m1.m[0]  +       m[1]*m1.m[3]    +       m[2]*m1.m[6];
00054         m2.m[1] = m[0]*m1.m[1]  +       m[1]*m1.m[4]    +       m[2]*m1.m[7];
00055         m2.m[2] = m[0]*m1.m[2]  +       m[1]*m1.m[5]    +       m[2]*m1.m[8];
00056         
00057         m2.m[3] = m[3]*m1.m[0]  +       m[4]*m1.m[3]    +       m[5]*m1.m[6];
00058         m2.m[4] = m[3]*m1.m[1]  +       m[4]*m1.m[4]    +       m[5]*m1.m[7];
00059         m2.m[5] = m[3]*m1.m[2]  +       m[4]*m1.m[5]    +       m[5]*m1.m[8];
00060         
00061         m2.m[6] = m[6]*m1.m[0]  +       m[7]*m1.m[3]    +       m[8]*m1.m[6];
00062         m2.m[7] = m[6]*m1.m[1]  +       m[7]*m1.m[4]    +       m[8]*m1.m[7];
00063         m2.m[8] = m[6]*m1.m[2]  +       m[7]*m1.m[5]    +       m[8]*m1.m[8];
00064         
00065         return m2;      
00066 }
00067 
00068 tgMatrix3 tgMatrix3::operator*(float f){
00069         tgMatrix3 m2;
00070         return m2;
00071 }
00072 
00073 tgVector3 tgMatrix3::operator*(tgVector3 v1){
00074         tgVector3 v2;
00075         
00076         v2.x = m[0]*v1.x + m[1]*v1.y + m[2]*v1.z;
00077         v2.y = m[3]*v1.x + m[4]*v1.y + m[5]*v1.z;
00078         v2.z = m[6]*v1.x + m[7]*v1.y + m[8]*v1.z;
00079         
00080         return v2;
00081 }
00082 
00083 void tgMatrix3::transpose(){
00084         tgMatrix3 m1 = tgMatrix3(*this);
00085         
00086         m[0]=m1.m[0];   m[1]=m1.m[3];   m[2]=m1.m[6];
00087         m[3]=m1.m[1];   m[4]=m1.m[4];   m[5]=m1.m[7];
00088         m[6]=m1.m[2];   m[7]=m1.m[5];   m[8]=m1.m[8];
00089 }
00090 
00091 
00092 


blort
Author(s): Michael Zillich, Thomas Mörwald, Johann Prankl, Andreas Richtsfeld, Bence Magyar (ROS version)
autogenerated on Thu Jan 2 2014 11:38:26