proj home

Files   Classes   Functions   Hierarchy  

regionD2linkedtest.cpp

Go to the documentation of this file.
00001 
00002 #include <commandline.h>
00003 #include <graphmisc.h>
00004 #include <point.h>
00005 #include <regionD2linked.h>
00006 #include <regionD2tess.h>
00007 #include <regionD2tessdisplay.h>
00008 #include <regionD2linkedtest.h>
00009 #include <typedefs.h>
00010 
00011 #include <graphmisc.h>
00012 #include <random.h>
00013 #include <zpr.h>
00014 
00015 
00016 void regionD2linkedtest::test01()
00017 {
00018   typedef point2<double> pt2;
00019   typedef regionD2linked< uint > region;
00020 
00021   vector<pt2> pts(1);
00022 
00023   pts.push_back( pt2(0.0,0.0) );
00024   pts.push_back( pt2(1.0,0.0) );
00025   pts.push_back( pt2(1.0,1.0) );
00026   pts.push_back( pt2(0.0,1.0) );
00027   pts.push_back( pt2(0.5,1.3) );
00028 
00029   vector< region > vi(1);
00030   vi.push_back( region(1,2,3,4,0,0,2,0) );
00031   vi.push_back( region(3,5,4,0,0,1) );
00032 
00033   regionD2tess< vector<region> &, vector<pt2> &, uint > 
00034     tess(vi,pts);
00035 
00036   tess.print();
00037 
00038   assert(tess.verify());
00039 
00040 
00041 }
00042 
00043 
00044 void regionD2linkedtest::keyboard01
00045 (
00046   unsigned char key, 
00047   int x, 
00048   int y
00049 )
00050 {
00051   switch (key)
00052   {
00053     case 27:
00054       exit(0);
00055       break;
00056   }
00057 }
00058 
00059 void regionD2linkedtest::display01()
00060 { 
00061   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00062 
00063   gobj::global->draw();
00064 
00065 
00066   glerrordisplay();
00067   
00068   glutSwapBuffers();
00069 }
00070 
00071 
00072 
00073 void regionD2linkedtest::test02(int argc, char** argv)
00074 {
00075   glutInit(&argc,argv);
00076   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00077   glutInitWindowSize(800,600);
00078   glutCreateWindow("");
00079   glutDisplayFunc(display01);
00080   glutKeyboardFunc(keyboard01);
00081 
00082   OpenGLinitialisation();
00083 
00084   glEnable(GL_DEPTH_TEST);
00085   glEnable(GL_CULL_FACE);
00086   glEnable(GL_NORMALIZE);
00087 
00088   xGraphics.set();
00089 
00090   commandline cmd(argc,argv);
00091 
00092   typedef point2<double> pt2;
00093   typedef regionD2linked< uint > region;
00094 
00095   vector<pt2> pts(1);
00096 
00097   pts.push_back( pt2(0.0,0.0) );
00098   pts.push_back( pt2(1.0,0.0) );
00099   pts.push_back( pt2(1.0,1.0) );
00100   pts.push_back( pt2(0.0,1.0) );
00101   pts.push_back( pt2(0.5,1.3) );
00102 
00103   vector< region > vi(1);
00104   vi.push_back( region(1,2,3,4,0,0,2,0) );
00105   vi.push_back( region(3,5,4,0,0,1) );
00106 
00107   typedef regionD2tess< vector<region> &, vector<pt2> &, uint > 
00108     tessregion; 
00109   tessregion tess(vi,pts);
00110 
00111   tess.printnumbered();
00112   assert(tess.verify());
00113 
00114   regionD2tessdisplaymesh<tessregion,uint> tessdisp(xGraphics,tess);
00115 
00116   tessdisp.draw();
00117 
00118   regionD2tessdisplaypoints<tessregion,uint> tesspoints(xGraphics,tess);
00119   tesspoints.draw();
00120 
00121   zpr zz;
00122   zz.update();
00123   glutMainLoop();
00124 }
00125 
00126 
00127 
00128 void regionD2linkedtest::test03(int argc, char** argv)
00129 {
00130   glutInit(&argc,argv);
00131   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00132   glutInitWindowSize(800,600);
00133   glutCreateWindow("");
00134   glutDisplayFunc(display01);
00135   glutKeyboardFunc(keyboard01);
00136 
00137   OpenGLinitialisation();
00138 
00139   glEnable(GL_DEPTH_TEST);
00140   glEnable(GL_CULL_FACE);
00141   glEnable(GL_NORMALIZE);
00142 
00143   xGraphics.set();
00144 
00145   commandline cmd(argc,argv);
00146 
00147   typedef point2<double> pt2;
00148 
00149   vector<pt2> pts(17);
00150 
00151   pts[0] =  pt2(0.0,0.0);
00152   pts[1] =  pt2(1.0,3.0);
00153   pts[2] =  pt2(2.0,3.0);
00154   pts[3] =  pt2(3.0,2.0);
00155   pts[4] =  pt2(3.0,1.0);
00156   pts[5] =  pt2(2.0,0.0);
00157   pts[6] =  pt2(1.0,0.0);
00158   pts[7] =  pt2(0.0,0.0);
00159   pts[8] =  pt2(0.0,1.0);
00160   pts[9] =  pt2(0.0,2.0);
00161   pts[10] = pt2(0.0,3.0);
00162   pts[11] = pt2(1.0,2.0);
00163   pts[12] = pt2(2.0,2.0);
00164   pts[13] = pt2(2.0,1.0);
00165   pts[14] = pt2(1.0,1.0);
00166   pts[15] = pt2(3.0,3.0);
00167   pts[16] = pt2(3.0,0.0);
00168 
00169 
00170   typedef regionD2linked< uint > region;
00171 
00172   vector< region > vi(1);
00173   vi.push_back( region(1,10,9,11,0,0,2,0) );
00174   vi.push_back( region(3,12,11,9,8,14,13,4,
00175                        5,0,1,0,3,0,4,0) );
00176   vi.push_back( region(14,8,7,6,2,0,0,0) );
00177   vi.push_back( region(4,13,5,16,2,0,0,0) );
00178   vi.push_back( region(3,15,2,12,0,0,0,2) );
00179 
00180   typedef regionD2tess< vector<region> &, vector<pt2> &, uint > 
00181     tessregion; 
00182   tessregion tess(vi,pts);
00183 
00184   tess.printnumbered();
00185   assert(tess.verify());
00186 
00187   regionD2tessdisplaymesh<tessregion,uint> tessdisp(xGraphics,tess);
00188 
00189   tessdisp.draw();
00190 
00191   regionD2tessdisplaypoints<tessregion,uint> tesspoints(xGraphics,tess);
00192   tesspoints.draw();
00193 
00194   zpr zz;
00195   glutMainLoop();
00196 }
00197 
00198 

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