proj home

Files   Classes   Functions   Hierarchy  

polytopesD2linkedtest Class Reference

#include <polytopeD2linkedtest.h>

Collaboration diagram for polytopesD2linkedtest:

List of all members.

Public Member Functions

void test02 (int argc, char **argv)
 Display a house.
void test03 (int argc, char **argv)
 Display the letter H.
void test04 (int argc, char **argv)
 Simple test to display a two region half space partition.

Static Public Member Functions

static void keyboard01 (unsigned char key, int x, int y)
 Default keyboard handler - ESC to quit.
static void display01 ()
 Displays the gobj::global with double buffering.
static void test01 ()


Detailed Description

Definition at line 6 of file polytopeD2linkedtest.h.


Member Function Documentation

void polytopesD2linkedtest::display01 (  )  [static]

Displays the gobj::global with double buffering.

Definition at line 195 of file polytopeD2linkedtest.cpp.

References gobjContainer::draw(), glerrordisplay(), and gobj::global.

Referenced by test02(), test03(), and test04().

00196 { 
00197   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00198 
00199   gobj::global->draw();
00200 
00201 
00202   glerrordisplay();
00203   
00204   glutSwapBuffers();
00205 }

void polytopesD2linkedtest::keyboard01 ( unsigned char  key,
int  x,
int  y 
) [static]

Default keyboard handler - ESC to quit.

Definition at line 181 of file polytopeD2linkedtest.cpp.

Referenced by test02(), test03(), and test04().

00186 {
00187   switch (key)
00188   {
00189     case 27:
00190       exit(0);
00191       break;
00192   }
00193 }

void polytopesD2linkedtest::test01 (  )  [static]

Definition at line 14 of file polytopeD2linkedtest.cpp.

References pts, and polytopeD2tess< VPOLY, VPTS >::verify().

Referenced by main().

00015 {
00016   typedef point2<double> pt2;
00017 
00018   vector<pt2> pts;
00019 
00020   pts.push_back( pt2(0.0,0.0) );
00021   pts.push_back( pt2(1.0,0.0) );
00022   pts.push_back( pt2(1.0,1.0) );
00023   pts.push_back( pt2(0.0,1.0) );
00024   pts.push_back( pt2(0.5,1.3) );
00025 
00026   vector<polytopeD2linked> vi(1);
00027   vi.push_back( polytopeD2linked(0,1,2,3,0,0,2,0) );
00028   vi.push_back( polytopeD2linked(2,4,3,0,0,1) );
00029 
00030   for (uint i=1; i<vi.size(); ++i)
00031     cout << (string)vi[i] << endl;
00032 
00033   polytopeD2tess< vector<polytopeD2linked>, vector<pt2> > 
00034     tess(vi,pts);
00035   assert(tess.verify());
00036 
00037 
00038 
00039   //polytopeD2linkedverify< vector<polytopeD2linked> > ver(vi);
00040   //assert(ver.eval());
00041 }

void polytopesD2linkedtest::test02 ( int  argc,
char **  argv 
)

Display a house.

Definition at line 43 of file polytopeD2linkedtest.cpp.

References polytopeD2tess< VPOLY, VPTS >::addpoint(), display01(), gobj::global, gobjpush, keyboard01(), polytopeD2tess< VPOLY, VPTS >::printvi(), pts, gobjContainer::set(), and polytopeD2tess< VPOLY, VPTS >::verify().

00044 {
00045   glutInit(&argc,argv);
00046   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00047   glutInitWindowSize(800,600);
00048   glutCreateWindow("");
00049   glutDisplayFunc(display01);
00050   glutKeyboardFunc(keyboard01);
00051 
00052   OpenGLinitialisation();
00053 
00054   glEnable(GL_DEPTH_TEST);
00055   glEnable(GL_CULL_FACE);
00056   glEnable(GL_NORMALIZE);
00057 
00058   xGraphics.set();
00059 
00060   commandline cmd(argc,argv);
00061 
00062   typedef point2<double> pt2;
00063 
00064   vector<pt2> pts(1);
00065 
00066   pts.push_back( pt2(0.0,0.0) );
00067   pts.push_back( pt2(1.0,0.0) );
00068   pts.push_back( pt2(1.0,1.0) );
00069   pts.push_back( pt2(0.0,1.0) );
00070   pts.push_back( pt2(0.5,1.3) );
00071 
00072   vector<polytopeD2linked> vi(1);
00073   vi.push_back( polytopeD2linked(1,2,3,4,0,0,2,0) );
00074   vi.push_back( polytopeD2linked(3,5,4,0,0,1) );
00075 
00076   polytopeD2tess< vector<polytopeD2linked>, vector<pt2> > 
00077     tess(vi,pts);
00078   assert(tess.verify());
00079 
00080   tess.printvi();
00081 
00082   pts.push_back( (pts[3]+pts[4])*0.5 );
00083   tess.addpoint(2,4,6);
00084 
00085   tess.printvi();
00086 
00087   assert(tess.verify());
00088 
00089   polytopeD2tessdisp01
00090   < 
00091     vector<pt2>, 
00092     vector<polytopeD2linked> 
00093   > tessdisp(pts,vi);
00094 
00095   tessdisp.multicolored=true;
00096   tessdisp.labelpolytopes=true;
00097   tessdisp.labelpoints=true;
00098 
00099   gobjpush(new gobjglDisable(GL_LIGHTING));
00100     
00101   tessdisp.eval(*gobj::global);
00102 
00103 //  glDisable(GL_DEPTH_TEST);
00104 //  glEnable(GL_BLEND);
00105 //  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00106 
00107   zpr zz;
00108   glutMainLoop();
00109 }

void polytopesD2linkedtest::test03 ( int  argc,
char **  argv 
)

Display the letter H.

Definition at line 112 of file polytopeD2linkedtest.cpp.

References display01(), gobj::global, keyboard01(), pts, and gobjContainer::set().

00113 {
00114   glutInit(&argc,argv);
00115   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00116   glutInitWindowSize(800,600);
00117   glutCreateWindow("");
00118   glutDisplayFunc(display01);
00119   glutKeyboardFunc(keyboard01);
00120 
00121   OpenGLinitialisation();
00122 
00123   glEnable(GL_DEPTH_TEST);
00124   glEnable(GL_CULL_FACE);
00125   glEnable(GL_NORMALIZE);
00126 
00127   xGraphics.set();
00128 
00129   commandline cmd(argc,argv);
00130 
00131   typedef point2<double> pt2;
00132 
00133   vector<pt2> pts(17);
00134 
00135   pts[0] =  pt2(0.0,0.0);
00136   pts[1] =  pt2(1.0,3.0);
00137   pts[2] =  pt2(2.0,3.0);
00138   pts[3] =  pt2(3.0,2.0);
00139   pts[4] =  pt2(3.0,1.0);
00140   pts[5] =  pt2(2.0,0.0);
00141   pts[6] =  pt2(1.0,0.0);
00142   pts[7] =  pt2(0.0,0.0);
00143   pts[8] =  pt2(0.0,1.0);
00144   pts[9] =  pt2(0.0,2.0);
00145   pts[10] = pt2(0.0,3.0);
00146   pts[11] = pt2(1.0,2.0);
00147   pts[12] = pt2(2.0,2.0);
00148   pts[13] = pt2(2.0,1.0);
00149   pts[14] = pt2(1.0,1.0);
00150   pts[15] = pt2(3.0,3.0);
00151   pts[16] = pt2(3.0,0.0);
00152 
00153 
00154   vector<polytopeD2linked> vi(1);
00155   vi.push_back( polytopeD2linked(1,10,9,11,0,0,2,0) );
00156   vi.push_back( polytopeD2linked(3,12,11,9,8,14,13,4,
00157                                  5,0,1,0,3,0,4,0) );
00158   vi.push_back( polytopeD2linked(14,8,7,6,2,0,0,0) );
00159   vi.push_back( polytopeD2linked(4,13,5,16,2,0,0,0) );
00160   vi.push_back( polytopeD2linked(3,15,2,12,0,0,0,2) );
00161 
00162   polytopeD2tessdisp01
00163   < 
00164     vector<pt2>, 
00165     vector<polytopeD2linked> 
00166   > tessdisp(pts,vi);
00167 
00168   tessdisp.multicolored=true;
00169   tessdisp.labelpolytopes=true;
00170   tessdisp.labelpoints=true;
00171     
00172   tessdisp.eval(*gobj::global);
00173 
00174   zpr zz;
00175   glutMainLoop();
00176 }

void polytopesD2linkedtest::test04 ( int  argc,
char **  argv 
)

Simple test to display a two region half space partition.

Definition at line 209 of file polytopeD2linkedtest.cpp.

References display01(), gobj::global, keyboard01(), pts, and gobjContainer::set().

00210 {
00211   glutInit(&argc,argv);
00212   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00213   glutInitWindowSize(800,600);
00214   glutCreateWindow("");
00215   glutDisplayFunc(display01);
00216   glutKeyboardFunc(keyboard01);
00217 
00218   OpenGLinitialisation();
00219 
00220   glEnable(GL_DEPTH_TEST);
00221   glEnable(GL_CULL_FACE);
00222   glEnable(GL_NORMALIZE);
00223 
00224   xGraphics.set();
00225 
00226   commandline cmd(argc,argv);
00227 
00228   typedef point2<double> pt2;
00229 
00230   vector<pt2> pts;
00231 
00232   pts.push_back( pt2(0.0,0.0) );
00233   pts.push_back( pt2(0.5,0.0) );
00234   pts.push_back( pt2(0.5,1.0) );
00235 
00236   vector<polytopeD2linked> vi(1);
00237   vi.push_back( polytopeD2linked(1,2,2,0) );
00238   vi.push_back( polytopeD2linked(2,1,1,0) );
00239 
00240   polytopeD2tessdisp01
00241   < 
00242     vector<pt2>, 
00243     vector<polytopeD2linked> 
00244   > tessdisp(pts,vi);
00245 
00246   tessdisp.multicolored=true;
00247   tessdisp.labelpolytopes=true;
00248   tessdisp.labelpoints=true;
00249     
00250   tessdisp.eval(*gobj::global);
00251 
00252   zpr zz;
00253   glutMainLoop();
00254 }


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:10 2011 for Chelton Evans Source by  doxygen 1.5.8