proj home

Files   Classes   Functions   Hierarchy  

tessD1disp01.h

Go to the documentation of this file.
00001 #ifndef TESSD1DISP01_H
00002 #define TESSD1DISP01_H
00003 
00004 #include <gobj.h>
00005 #include <graphicsImmediateDeferredSwitch.h>
00006 #include <graphmisc.h>
00007 #include <pointsdisplay.h>
00008 #include <random.h>
00009 #include <typeop.h>
00010 
00020 template< typename TESS, typename PT, typename INDX >
00021 class tessD1disp01 : public graphicsImmediateDeferredSwitch
00022 {
00023 public:
00024 
00026   TESS & tess;
00027 
00029   tessD1disp01(TESS & tess_) : tess(tess_) {};
00030 
00032   template< typename K >
00033   K* displayDeferred(uint & index, typeop<K> tp)
00034   {
00035     K* x = new K(tess);
00036 
00037     pushdeferred(index,x);
00038 
00039     return x;
00040   }
00041 
00043   template< typename K >
00044   K* displayImmediate(uint & index, typeop<K> tp)
00045   {
00046     K* x = new K(tess);
00047 
00048     pushSwitchImmediate(index,x);
00049 
00050     return x;
00051   }
00052 };
00053 
00054 
00058 template< typename TESS, typename PT >
00059 class tessD1draw01points : public gobjContainer
00060 {
00061   TESS & tess;
00062 public:
00063 
00065   gobjglColor3ub col;
00066 
00068   tessD1draw01points(TESS & tess_)
00069     : tess(tess_), col(255,255,0) {}
00070 
00072   void draw();
00073 };
00074 
00075 
00080 template< typename TESS, typename PT >
00081 class tessD1draw01lines : public gobjContainer
00082 {
00083   TESS & tess;
00084 public:
00085 
00087   gobjglColor3ub col;
00088 
00090   tessD1draw01lines(TESS & tess_)
00091     : tess(tess_), col(255,165,0) {}
00092 
00094   void draw();
00095 };
00096 
00097 
00098 
00099 
00100 
00105 template< typename TESS, typename PT >
00106 class tessD1draw01linesmulticolor : public gobjContainer
00107 {
00108   TESS & tess;
00109 public:
00110 
00112   tessD1draw01linesmulticolor(TESS & tess_)
00113     : tess(tess_) {}
00114 
00116   void draw();
00117 };
00118 
00119 
00120 
00121 
00126 template< typename TESS, typename PT >
00127 class tessD1draw01simplexindexes: public gobjContainer
00128 {
00129   TESS & tess;
00130 public:
00131 
00133   gobjglColor3ub col;
00134 
00136   tessD1draw01simplexindexes(TESS & tess_)
00137     : tess(tess_), col(255,0,0) {}
00138 
00140   void draw();
00141 };
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 //---------------------------------------------------------
00150 // Implementation
00151 
00152 
00153 template< typename TESS, typename PT >
00154 void tessD1draw01points<TESS,PT>::draw()
00155 {
00156   gobjContainer & y = * new gobjContainer(true);
00157 
00158   y.push( new gobjglPushAttrib(GL_CURRENT_BIT) );
00159   y.push( new gobjglPushAttrib(GL_LIGHTING_BIT) );
00160 
00161   y.push( new gobjglDisable(GL_LIGHTING) );
00162 
00163   y.push( new gobjglColor3ub(col) );
00164     
00165   pointsdisplay2D< PT > dp(y,tess.pts);
00166 
00167   y.push( new gobjglPopAttrib() );
00168   y.push( new gobjglPopAttrib() );
00169 
00170   gobjpush(&y);
00171 }
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 template< typename TESS, typename PT >
00182 void tessD1draw01linesmulticolor<TESS,PT>::draw()
00183 {
00184   gobjContainer & y = * new gobjContainer(true);
00185 
00186   y.push( new gobjglPushAttrib(GL_CURRENT_BIT) );
00187   y.push( new gobjglPushAttrib(GL_LIGHTING_BIT) );
00188 
00189   y.push( new gobjglDisable(GL_LIGHTING) );
00190 
00191   random11<double> r;
00192 
00193   // Display the solid lines
00194   for (uint i=1; i<tess.vi.size(); ++i)
00195   {
00196     PT p0(tess.pts[tess.vi[i].pi[0]]);
00197     PT p1(tess.pts[tess.vi[i].pi[1]]);
00198     PT q0((p0+p1)*0.5);
00199 
00200     y.push( new gobjglColor3f(r(),r(),r()) );
00201 
00202     y.push( new gobjglBegin(GL_LINES) );
00203     y.push(new gobjglVertex2f(p0));
00204     y.push(new gobjglVertex2f(q0));
00205     y.push( new gobjglEnd() );
00206 
00207     y.push( new gobjglEnable(GL_LINE_STIPPLE) );
00208     y.push( new gobjglLineStipple(1,0x00FF) );
00209     y.push( new gobjglBegin(GL_LINES) );
00210     y.push(new gobjglVertex2f(p1));
00211     y.push(new gobjglVertex2f(q0));
00212     y.push( new gobjglEnd() );
00213     y.push( new gobjglDisable(GL_LINE_STIPPLE) );
00214   }
00215 
00216   y.push( new gobjglPopAttrib() );
00217   y.push( new gobjglPopAttrib() );
00218 
00219   gobjpush(&y);
00220 }
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 template< typename TESS, typename PT >
00231 void tessD1draw01lines<TESS,PT>::draw()
00232 {
00233   gobjContainer & y = * new gobjContainer(true);
00234 
00235   y.push( new gobjglPushAttrib(GL_CURRENT_BIT) );
00236   y.push( new gobjglPushAttrib(GL_LIGHTING_BIT) );
00237 
00238   y.push( new gobjglDisable(GL_LIGHTING) );
00239 
00240   y.push( new gobjglColor3ub(col) );
00241 
00242   // Display the solid lines
00243   y.push( new gobjglBegin(GL_LINES) );
00244   for (uint i=1; i<tess.vi.size(); ++i)
00245   {
00246     PT p0(tess.pts[tess.vi[i].pi[0]]);
00247     PT p1(tess.pts[tess.vi[i].pi[1]]);
00248     PT q0((p0+p1)*0.5);
00249 
00250     y.push(new gobjglVertex2f(p0));
00251     y.push(new gobjglVertex2f(q0));
00252   }
00253   y.push( new gobjglEnd() );
00254 
00255   // Display the broken lines
00256   y.push( new gobjglEnable(GL_LINE_STIPPLE) );
00257   y.push( new gobjglLineStipple(1,0x00FF) );
00258 
00259   y.push( new gobjglBegin(GL_LINES) );
00260   for (uint i=1; i<tess.vi.size(); ++i)
00261   {
00262     PT p0(tess.pts[tess.vi[i].pi[0]]);
00263     PT p1(tess.pts[tess.vi[i].pi[1]]);
00264     PT q0((p0+p1)*0.5);
00265 
00266     y.push(new gobjglVertex2f(p1));
00267     y.push(new gobjglVertex2f(q0));
00268   }
00269   y.push( new gobjglEnd() );
00270   y.push( new gobjglDisable(GL_LINE_STIPPLE) );
00271 
00272 
00273   y.push( new gobjglPopAttrib() );
00274   y.push( new gobjglPopAttrib() );
00275 
00276   gobjpush(&y);
00277 }
00278 
00279 
00280 template< typename TESS, typename PT >
00281 void tessD1draw01simplexindexes<TESS,PT>::draw()
00282 {
00283   gobjContainer & y = * new gobjContainer(true);
00284 
00285   vector< PT > v2;
00286   v2.resize(tess.vi.size());
00287   for (uint i=1; i<tess.vi.size(); ++i)
00288   {
00289     v2[i] = (tess.pts[ tess.vi[i].pi[0] ] + tess.pts[ tess.vi[i].pi[1] ])*0.5;
00290   }
00291 
00292   y.push( new gobjglPushAttrib(GL_CURRENT_BIT) );
00293   y.push( new gobjglPushAttrib(GL_LIGHTING_BIT) );
00294 
00295   y.push( new gobjglDisable(GL_LIGHTING) );
00296 
00297   y.push( new gobjglColor3ub(col) );
00298 
00299 
00300   pointsdisplay2D< PT > dp(y,v2);
00301 
00302   y.push( new gobjglPopAttrib() );
00303   y.push( new gobjglPopAttrib() );
00304 
00305   gobjpush(&y);
00306 }
00307 
00308 
00309 
00310 
00311 
00312 
00313 
00314 
00315 #endif
00316 

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