Matrix4TMD Class Reference

List of all members.

Public Member Functions

 Matrix4TMD (void)
 Matrix4TMD (const BigReal *m)
void multpoint (BigReal point[3]) const
void identity ()
void transpose ()
void multmatrix (const Matrix4TMD &m)
 premultiply the matrix by the given matrix, this->other * this
void translate (BigReal x, BigReal y, BigReal z)
void translate (BigReal d[3])

Detailed Description

Definition at line 23 of file GlobalMasterTMD.C.


Constructor & Destructor Documentation

Matrix4TMD::Matrix4TMD ( void   )  [inline]

Definition at line 26 of file GlobalMasterTMD.C.

References identity().

00026 { identity(); }

Matrix4TMD::Matrix4TMD ( const BigReal m  )  [inline]

Definition at line 27 of file GlobalMasterTMD.C.

00027 { memcpy(mat, m, 16*sizeof(BigReal)); }


Member Function Documentation

void Matrix4TMD::identity (  )  [inline]

Definition at line 40 of file GlobalMasterTMD.C.

Referenced by Matrix4TMD().

00040                   {
00041     memset(mat, 0, 16*sizeof(BigReal));
00042     mat[0]=1.0f;
00043     mat[5]=1.0f;
00044     mat[10]=1.0f;
00045     mat[15]=1.0f;
00046   }

void Matrix4TMD::multmatrix ( const Matrix4TMD m  )  [inline]

premultiply the matrix by the given matrix, this->other * this

Definition at line 58 of file GlobalMasterTMD.C.

References j, and mat.

Referenced by translate().

00058                                        {
00059     BigReal tmp[4];
00060     for (int j=0; j<4; j++) {
00061       tmp[0] = mat[j];
00062       tmp[1] = mat[4+j];
00063       tmp[2] = mat[8+j]; 
00064       tmp[3] = mat[12+j];
00065       for (int i=0; i<4; i++) {
00066         mat[4*i+j] = m.mat[4*i]*tmp[0] + m.mat[4*i+1]*tmp[1] +
00067           m.mat[4*i+2]*tmp[2] + m.mat[4*i+3]*tmp[3]; 
00068       }
00069     } 
00070   }

void Matrix4TMD::multpoint ( BigReal  point[3]  )  const [inline]

Definition at line 28 of file GlobalMasterTMD.C.

00028                                          {
00029     BigReal tmp[3];
00030     BigReal itmp3 = 1.0f / (point[0]*mat[3] + point[1]*mat[7] +
00031                             point[2]*mat[11] + mat[15]);
00032     tmp[0] = itmp3*point[0];
00033     tmp[1] = itmp3*point[1];
00034     tmp[2] = itmp3*point[2];
00035     point[0]=tmp[0]*mat[0] + tmp[1]*mat[4] + tmp[2]*mat[ 8] + itmp3*mat[12];
00036     point[1]=tmp[0]*mat[1] + tmp[1]*mat[5] + tmp[2]*mat[ 9] + itmp3*mat[13];
00037     point[2]=tmp[0]*mat[2] + tmp[1]*mat[6] + tmp[2]*mat[10] + itmp3*mat[14];
00038   }

void Matrix4TMD::translate ( BigReal  d[3]  )  [inline]

Definition at line 78 of file GlobalMasterTMD.C.

References translate().

00078 { translate(d[0], d[1], d[2]); }

void Matrix4TMD::translate ( BigReal  x,
BigReal  y,
BigReal  z 
) [inline]

Definition at line 71 of file GlobalMasterTMD.C.

References mat, and multmatrix().

Referenced by translate().

00071                                                   {
00072     Matrix4TMD m;               
00073     m.mat[12] = x;
00074     m.mat[13] = y;
00075     m.mat[14] = z;
00076     multmatrix(m);
00077   }

void Matrix4TMD::transpose (  )  [inline]

Definition at line 47 of file GlobalMasterTMD.C.

References j.

00047                    {
00048     BigReal tmp[16];
00049     int i,j;
00050     for(i=0;i<4;i++) {
00051       for(j=0;j<4;j++) {
00052         tmp[4*i+j] = mat[i+4*j];
00053       }
00054     }
00055     for(i=0;i<16;i++) mat[i] = tmp[i];
00056   }


The documentation for this class was generated from the following file:
Generated on Sun Sep 24 01:17:18 2017 for NAMD by  doxygen 1.4.7