proj home

Files   Classes   Functions   Hierarchy  

d4grid.cpp

Go to the documentation of this file.
00001 
00002 
00003 #include <d4grid.h>
00004 #include <d4tessdraw.h>
00005 
00006 
00007 void d4grid::add
00008 (
00009   uintc i,
00010   uintc k,
00011   uintc m
00012 )
00013 {
00014   unsigned int t = 6*(i+k*dimX+m*dimX*dimY);
00015 
00016 //
00017 //  NOTE:
00018 //
00019 //  Grid not connected up.
00020 //  <TODO> Connect up so can transverse grid. 
00021 //
00022 
00023   uintc n00=0;    
00024   uintc n01=0;   
00025   uintc n02=t+2;
00026   uintc n03=0;   
00027 
00028   uintc n10=t+2;
00029   uintc n11=0;   
00030   uintc n12=t+4;
00031   uintc n13=0;   
00032 
00033   uintc n20=t+3;
00034   uintc n21=t+1;
00035   uintc n22=t+0;
00036   uintc n23=0;   
00037 
00038   uintc n30=0;
00039   uintc n31=t+4;
00040   uintc n32=0;
00041   uintc n33=t+2;
00042 
00043   uintc n40=t+5;
00044   uintc n41=t+3;
00045   uintc n42=t+1;
00046   uintc n43=0;
00047 
00048   uintc n50=0;
00049   uintc n51=0;
00050   uintc n52=t+4;
00051   uintc n53=0;
00052 
00053   uintc dx=1;
00054   uintc dy=dimX+1;
00055   uintc dz=(dimX+1)*(dimY+1);
00056 
00057   uintc w=i*dx+k*dy+m*dz;
00058 
00059   uintc p0=w;
00060   uintc p1=w+dx;
00061   uintc p2=w+dx   +dz;
00062   uintc p3=w      +dz;
00063   uintc p4=w   +dy;
00064   uintc p5=w+dx+dy;
00065   uintc p6=w+dx+dy+dz;
00066   uintc p7=w   +dy+dz;
00067 
00068                                        // Triangle
00069   viadd(p1,p3,p2,p6,n00,n01,n02,n03);  // 0
00070   viadd(p5,p1,p6,p7,n10,n11,n12,n13);  // 1
00071   viadd(p6,p3,p7,p1,n20,n21,n22,n23);  // 2
00072 
00073   viadd(p7,p3,p1,p0,n30,n31,n32,n33);  // 3 
00074   viadd(p1,p5,p0,p7,n40,n41,n42,n43);  // 4
00075   viadd(p0,p5,p4,p7,n50,n51,n52,n53);  // 5
00076 }
00077 
00078 
00079 d4grid::d4grid
00080 (
00081   uintc _dimX,
00082   uintc _dimY,
00083   uintc _dimZ,
00084   realc x0,
00085   realc x1,
00086   realc y0,
00087   realc y1,
00088   realc z0,
00089   realc z1
00090 )
00091   : d4tess(6*(_dimX+1)*(_dimY+1)*(_dimZ+1)),
00092   dimX(_dimX), dimY(_dimY), dimZ(_dimZ)
00093 {
00094   realc dx = 1.0/dimX;
00095   realc dy = 1.0/dimY;
00096   realc dz = 1.0/dimZ;
00097 
00098   realc xlen=x1-x0;
00099   realc ylen=y1-y0;
00100   realc zlen=z1-z0;
00101 
00102   unsigned int i,k,m;
00103 
00104   for (m=0; m<(dimZ+1); ++m)
00105     for (k=0; k<(dimY+1); ++k)
00106       for (i=0; i<(dimX+1); ++i)
00107       {
00108         pt.push_back( point4<real>(x0+i*dx*xlen,y0+k*dy*ylen,z0+m*dz*zlen,0.0) );
00109         //ptadd(x0+i*dx*xlen,y0+k*dy*ylen,z0+m*dz*zlen); 
00110         //add(i,k,m);
00111       }
00112 
00113 
00114   for (m=0; m<dimZ; ++m)
00115     for (k=0; k<dimY; ++k)
00116       for (i=0; i<dimX; ++i)
00117         add(i,k,m);
00118 
00119 
00120 }
00121 
00122 
00123 
00124 
00125 
00126 
00127 void d4grid::draw(realc cut) const
00128 {
00129 
00130 //  d4tessdraw tetd(*this);
00131 
00132 cout << "Recode - code was broken." << endl;
00133 assert(false);
00134 
00135 //  tetd.draw(cut);
00136 
00137 //  uintc visz = vi.size();
00138 //  for (unsigned int i=0; i<visz; ++i)
00139 //    tetd.draw(i,cut);
00140 }
00141 
00142 
00143 
00144 
00145 
00146 

Generated on Fri Mar 4 00:49:31 2011 for Chelton Evans Source by  doxygen 1.5.8