Main Page | Alphabetical List | Class List | File List | Class Members | File Members

t3d.h

Go to the documentation of this file.
00001 /*
00002 ** ---------------------------------------------------------------
00003 ** t3d.h: 3D matrix transformations class definition.
00004 **
00005 ** ---------------------------------------------------------------
00006 */
00007 
00008 #ifndef _T3D_H
00009 #define _T3D_H 
00010 
00050 class T3d
00051 {
00052  private:
00053 /*
00054 ** ---------------------------------------------------------------
00055 ** Private data type definitions:
00056 */
00059   struct Vec {
00061     double    x;
00063     double    y;
00065     double    z;
00066    };
00067 
00068 /*
00069 ** ---------------------------------------------------------------
00070 ** Private class variables:
00071 **
00072 */
00075   static double mt[4][4];
00076 
00077 /*
00078 ** ---------------------------------------------------------------
00079 ** Private class functions:
00080 */
00081 /* --------------------------------------------------------------- */
00089   static inline double rad( double a )
00090   {
00091    return( a * 0.01745329252 );
00092   }
00093 
00094 /* --------------------------------------------------------------- */
00100   static inline void VecUnit( Vec* a, Vec* b )
00101   {
00102    double len = sqrt(a->x*a->x + a->y*a->y + a->z*a->z);
00103 
00104    if( len != 0.0 )
00105    {
00106     b->x = a->x / len;
00107     b->y = a->y / len;
00108     b->z = a->z / len;
00109    }
00110   }
00111 
00112 /* --------------------------------------------------------------- */
00118   static inline void VecCross( Vec* a, Vec* b, Vec* c )
00119   { 
00120    c->x = a->y * b->z - a->z * b->y;
00121    c->y = a->z * b->x - a->x * b->z;
00122    c->z = a->x * b->y - a->y * b->x;
00123   }
00124 
00125 /* --------------------------------------------------------------- */
00131   static void Accumulate( double new_mt[4][4] );
00132 
00133  public:
00134 /*
00135 ** ---------------------------------------------------------------
00136 ** Public class functions:
00137 **
00138 */
00139 /* --------------------------------------------------------------- */
00149   static void Transform( double* x, double* y, double* z );
00150 
00151 /* --------------------------------------------------------------- */
00156   static void Identity( void );
00157 
00158 /* --------------------------------------------------------------- */
00166   static void Scale( double sx, double sy, double sz );
00167 
00168 /* --------------------------------------------------------------- */
00176   static void Translate( double tx, double ty, double tz );
00177 
00178 /* --------------------------------------------------------------- */
00192   static void RotateBasis( double ux, double uy, double uz, 
00193                            double vx, double vy, double vz,
00194                            double wx, double wy, double wz );
00195 
00196 /* --------------------------------------------------------------- */
00217   static void Camera( double eyex, double eyey, double eyez, 
00218                       double refx, double refy, double refz,
00219                       double vupx, double vupy, double vupz );
00220 
00221 /* --------------------------------------------------------------- */
00250   static void Perspective( double d, double front, double back );
00251 
00252 /* --------------------------------------------------------------- */
00280   static void NormalizeView( double left, double right,
00281                              double bottom, double top,
00282                              double front, double back );
00283 
00284 };
00285 
00288 #endif

Generated on Mon Jun 20 18:09:52 2011 for Trab8 by  doxygen 1.4.2-20050421