proj home

Files   Classes   Functions   Hierarchy  

main.cpp File Reference

#include <cassert>
#include <iostream>
#include <deque>
#include <GL/glut.h>
#include <GL/gl.h>
#include <typedefs.h>
#include <point.h>
#include <random.h>
#include <gobj.h>
#include <polytrimon.h>

Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

void shape02 (vector< point2< float > > &vL)
void shape01 (vector< point2< float > > &vL)
void test01 ()
void display ()
void keyboard (unsigned char key, int x, int y)
void test02 (int argc, char **argv)
int main (int argc, char **argv)

Variables

gobjContainer xGraphics (true)
vector< point2< float > > pts


Function Documentation

void display (  ) 

Definition at line 144 of file main.cpp.

References gobjContainer::draw(), and xGraphics.

00145 {
00146   glClear(GL_COLOR_BUFFER_BIT);
00147 
00148   xGraphics.draw();
00149 
00150   glFlush();
00151 }

void keyboard ( unsigned char  key,
int  x,
int  y 
)

Definition at line 153 of file main.cpp.

00154 {
00155   switch (key)
00156   {
00157     case 27:
00158       exit(0);
00159       break;
00160   }
00161 }

int main ( int  argc,
char **  argv 
)

Definition at line 225 of file main.cpp.

References test02().

00226 {
00227   test02(argc,argv);
00228 
00229   return 0;
00230 }

void shape01 ( vector< point2< float > > &  vL  ) 

Definition at line 41 of file main.cpp.

Referenced by test01(), and test02().

00042 {
00043   vL.clear();
00044 
00045   uintc vsz = 25;
00046   float v[vsz*2] = 
00047   {
00048     6.0, 17.0,
00049     5.5, 16.0,
00050     6.5, 15.0,
00051     8.0, 14.0,
00052    11.0, 11.5,
00053 
00054    15.0, 10.5,
00055     8.0,  9.5,
00056    10.0,  9.0,
00057     7.0,  8.5,
00058     6.5,  7.5,
00059 
00060     9.0,  7.5,
00061     9.5,  6.5,
00062     9.0,  5.0,
00063     7.0,  3.0,
00064     9.0,  1.5,
00065 
00066    13.0,  0.0,
00067     0.0,  1.0,
00068     4.0,  2.0,
00069     9.0,  6.0,
00070     5.0,  6.0,
00071 
00072     3.0,  8.0,
00073     5.5, 10.0,
00074     6.0, 11.0,
00075     5.0, 12.0,
00076     1.0, 13.5,
00077   };
00078 
00079   for (uint i=0; i<vsz; ++i)
00080     vL.push_back( point2<float>(v[i*2],v[i*2+1]) );
00081 }

void shape02 ( vector< point2< float > > &  vL  ) 

Definition at line 20 of file main.cpp.

00021 {
00022   vL.clear();
00023 
00024   uintc vsz = 7;
00025   float v[vsz*2] = 
00026   {
00027      4.0, 9.0,
00028      7.0, 8.0,
00029      7.0, 5.0,
00030      8.0, 3.0,
00031     12.0, 2.0,
00032      1.0, 0.0,
00033      0.0, 7.0
00034   };
00035 
00036   for (uint i=0; i<vsz; ++i)
00037     vL.push_back( point2<float>(v[i*2],v[i*2+1]) );
00038 }

void test01 (  ) 

Definition at line 101 of file main.cpp.

References pts, shape01(), and polytrimon::tessellate().

00102 {
00103 
00104   vector< point2<float> > pts;
00105 
00106   shape01(pts);
00107 
00108   polytrimon p(pts);
00109 
00110   p.tessellate( printtri() );
00111 
00112 }

void test02 ( int  argc,
char **  argv 
)

Definition at line 163 of file main.cpp.

References display(), gobj::global, keyboard(), pts, gobjContainer::push(), gobjContainer::set(), shape01(), polytrimon::tessellate(), and xGraphics.

00164 {
00165   glutInit(&argc,argv);
00166   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
00167   
00168   uintc wx=600;
00169   uintc wy=800;
00170   glutInitWindowSize(wx,wy);
00171 
00172   glutCreateWindow("");
00173   glutKeyboardFunc(keyboard);
00174 
00175   glMatrixMode(GL_PROJECTION);
00176   glLoadIdentity();
00177 
00178   
00179   float x0 = -5.0;
00180   float x1 = 20.0;
00181 
00182   float dx = x1-x0;
00183   float dy = dx/(float)wx*wy; 
00184   
00185   float y0 = -5.0;
00186   float y1 = dy;
00187 
00188   gluOrtho2D(x0,x1,y0,y1);
00189 
00190   glutDisplayFunc(display);
00191 
00192   xGraphics.set();
00193 
00194 
00195   //
00196   //  Finish with graphics initialization
00197 
00198   shape01(pts);
00199 
00200 
00201   gobjContainer * c = gobjContainer::global;
00202 /*
00203   c->push_back(new gobjglColor3f(1.0,0.0,0.0));
00204 
00205   c->push_back( new gobjGL_LINE_LOOP() );
00206   for (unsigned int i=0; i<pts.size(); ++i)
00207     c->push_back( new gobjglVertex2f(pts[i].x,pts[i].y) );
00208   c->push_back( new gobjglEnd() );
00209 */
00210 
00211   polytrimon p(pts);
00212 
00213   c->push( new gobjglBegin(GL_TRIANGLES) );
00214   p.tessellate( drawtri() );
00215   c->push( new gobjglEnd() );
00216 
00217   glutMainLoop();
00218 }


Variable Documentation

vector< point2<float> > pts

Definition at line 116 of file main.cpp.

Referenced by plotpolar::addcrosses(), plotpolar::adddatapointsinPolarDegrees(), plotpolar::adddatapointsinPolarRadians(), polytopeD2tess< VPOLY, VPTS >::addpoint(), plotpolar::addpoints(), arc::arcreader(), simplexD2tessindexed< PT, PD, INDX >::construct(), simplexD1tessindexed< PT, PD, INDX >::construct(), triangleuniformsubdivision< T >::divide(), polytopeD2tessdisp01< VPTS, VPOLY >::eval(), exploretest02(), delaunaysimpleD2< PT, PD, INDX >::get(), halfspaceContainer< HS, PT >::isInsideOrOnBoundary(), leastsqrs::leastsqrs(), simplexD1listlinked< VI, INDX >::makelinks(), leastsqrs::operator()(), triangles3Tdisplaytest::pipe01(), triangles3Tdisplaytest::pipe02(), polytrimon::polytrimon(), quickhull2Drandomized< PT, D >::quickhull2Drandomized(), halfspaceContainer< HS, PT >::subtractfrom(), triangles3Tdisplaytest::test01(), regionD2linkedtest::test01(), polytopesD2linkedtest::test01(), convexregionsD2test::test01(), test01(), linetest::test02(), triangles3Tdisplaytest::test02(), regionD2linkedtest::test02(), polytopesD2linkedtest::test02(), test02(), halfspaceD3test::test03(), triangles3Tdisplaytest::test03(), regionD2linkedtest::test03(), polytopesD2linkedtest::test03(), meshpatchtest::test03(), quickhull2Dtest::test04(), triangles3Tdisplaytest::test04(), polytopesD2linkedtest::test04(), meshpatchtest::test04(), test04(), quickhull2Dtest::test05(), triangles3Tdisplaytest::test05(), test05(), quickhull2Dtest::test06(), circleD2test::update01(), and boxOBBhalfspaceD2test::update01().


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