proj home

Files   Classes   Functions   Hierarchy  

main.cpp File Reference

#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <GL/glut.h>
#include <GL/gl.h>
#include <zpr.h>
#include <graphmisc.h>
#include <print.h>
#include <commandline.h>
#include <gobj.h>
#include <halfspaceD2.h>
#include <halfspaceD2draw.h>
#include <d3tess.h>
#include <d3clipping.h>
#include <d3circlepartition.h>
#include <d3circlepartitiondraw.h>
#include <d2partitiondraw.h>
#include <d3meshiterrecursive.h>
#include <d3meshpartition.h>
#include <d3meshpartitiondraw.h>
#include <test01obj.h>

Include dependency graph for main.cpp:

Go to the source code of this file.

Typedefs

typedef unsigned int uint
typedef unsigned int const uintc
typedef point2< double > pt2
typedef point3< double > pt3

Functions

void tessinitgeneral (d3tess &tess, double const *d, uintc dsz, uintc *ti, uintc tisz)
void tessinit03 (d3tess &tess)
void tessinit01 (d3tess &tess)
void tessinit02 (d3tess &tess)
void test01 (d3tess &tess)
int main (int argc, char **argv)


Typedef Documentation

typedef point2<double> pt2

Definition at line 46 of file main.cpp.

typedef point3<double> pt3

Definition at line 47 of file main.cpp.

typedef unsigned int uint

Definition at line 43 of file main.cpp.

typedef unsigned int const uintc

Definition at line 44 of file main.cpp.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 225 of file main.cpp.

References test01obj< P, PD >::eval(), commandline::mapvar(), tessinit01(), tessinit02(), and tessinit03().

00226 {
00227   commandline cmd(argc,argv);
00228   uint prog(0);
00229   cmd.mapvar(prog,"prog");
00230 
00231   switch (prog)
00232   {
00233     case 0:
00234       cout << "Test programs for clipping workspace" << endl << endl;
00235       cout << "$./main prog=3         - clipping A with another mesh" << endl;
00236       cout << "$./main prog=2         - clipping A with circle partition" << endl;
00237       cout << "$/.main prog=1         - clipping A with halfspace" << endl;
00238       break;
00239   
00240     case 1:
00241     {
00242       test01obj<halfspaceD2< pt3, double >,halfspaceD2draw> x
00243       (
00244         tessinit01,
00245         new halfspaceD2< pt3, double >( pt3(2.5,-2.0,0.0), pt3(8.0,7.5,0.0) ),
00246         argc,argv,GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH,800,600,""
00247       );
00248 
00249       x.eval();
00250       glutMainLoop();
00251       break;
00252     }
00253 
00254     case 2:
00255     {
00256       test01obj<d3circlepartition,d3circlepartitiondraw> x
00257       (
00258         tessinit01,
00259         new d3circlepartition( pt2(2.0,2.0), 1.5),
00260         argc,argv,GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH,800,600,""
00261       );
00262 
00263       x.eval();
00264       glutMainLoop();
00265 
00266       break;
00267     }
00268 
00269     case 3:
00270     {
00271       unsigned int const N(100);
00272       d3tess * meshB = new d3tess(N);
00273       tessinit02(*meshB);
00274       
00275       test01obj<d3meshpartition,d3meshpartitiondraw> x
00276       (
00277         tessinit03,
00278         new d3meshpartition(*meshB),
00279         argc,argv,GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH,800,600,""
00280       );
00281 
00282       x.eval();
00283       glutMainLoop();
00284 
00285       break;
00286     }
00287 
00288     default: cout << "error:  No case handled." << endl; return 1;
00289   }
00290 
00291   return 0;
00292 }

void tessinit01 ( d3tess tess  ) 

Definition at line 98 of file main.cpp.

References d3tess::debugcheck(), d3tess::pt, d3tess::reset(), and d3tess::viadd().

Referenced by main(), and test01().

00099 {
00100   tess.reset();
00101 
00102   uintc dsz=16;
00103   double const d[dsz*2] = 
00104   { 
00105     0.0, 0.0,   // The tessellation starts from index 1.
00106     2.0, 0.0,
00107     2.0, 2.0,
00108     4.0, 2.0,
00109     4.0, 0.0,
00110 
00111     6.0, 0.0,
00112     6.0, 6.0,
00113     2.0, 5.0,
00114     4.0, 5.0,
00115     4.0, 4.0,
00116  
00117     2.0, 4.0,
00118     0.0, 6.0,
00119     1.0, 0.0,
00120     2.0, 6.0,
00121     3.0, 4.0,
00122 
00123     2.0, 3.0
00124 
00125   };
00126 
00127   for (uint i=0; i<dsz; ++i)
00128     tess.pt.push_back( pt3(d[i*2],d[i*2+1],0.0) );
00129 
00130   uintc tisz=12;
00131   uint ti[] = 
00132   {
00133     1,2,3,   0,2,0,
00134     1,3,12,  3,0,1,
00135     3,11,12, 12,2,4,
00136     3,4,11,  5,3,0,
00137     4,10,11, 0,4,6,
00138 
00139     10,4,6,  7,8,5,
00140     5,6,4,   6,0,0,
00141     6,7,10,  9,6,0,
00142     10,7,9,  10,0,8,
00143     7,8,9,   0,9,11,
00144     
00145     8,7,12,  0,12,10,
00146     12,11,8, 0,11,3
00147 
00148   };
00149 
00150   uint k;
00151   for (uint i=0; i<tisz; ++i)
00152   {
00153     k=i*6;
00154     tess.viadd( ti[k], ti[k+1], ti[k+2], ti[k+3], ti[k+4], ti[k+5] );
00155   }
00156 
00157   tess.debugcheck();
00158 
00159 }

void tessinit02 ( d3tess tess  ) 

Definition at line 161 of file main.cpp.

References d3tess::debugcheck(), d3tess::pt, d3tess::reset(), and d3tess::viadd().

Referenced by main().

00162 {
00163   tess.reset();
00164 
00165   uintc dsz=6;
00166   double const d[dsz*2] = 
00167   { 
00168     1.0, 0.0,
00169     3.0, 0.5,
00170     0.5, 1.0,
00171    -0.5, 2.0,
00172     0.0, 0.5
00173 
00174   };
00175 
00176   for (uint i=0; i<dsz; ++i)
00177     tess.pt.push_back( pt3(d[i*2],d[i*2+1],0.0) );
00178 
00179   uintc tisz=3;
00180   uint ti[] = 
00181   {
00182     1,2,3,   0,2,0,
00183     5,1,3,   1,3,0,
00184     5,3,4,   0,0,2
00185   };
00186 
00187   uint k;
00188   for (uint i=0; i<tisz; ++i)
00189   {
00190     k=i*6;
00191     tess.viadd( ti[k], ti[k+1], ti[k+2], ti[k+3], ti[k+4], ti[k+5] );
00192   }
00193 
00194   tess.debugcheck();
00195 }

void tessinit03 ( d3tess tess  ) 

Definition at line 76 of file main.cpp.

References tessinitgeneral().

Referenced by main().

00077 {
00078   uintc dsz=4;
00079   double const d[] = 
00080   { 
00081     0.0, 0.0,
00082     2.0, 0.0,
00083     2.0, 2.0,
00084     0.0, 6.0
00085   };
00086 
00087   uintc tisz=2;
00088   uint ti[] = 
00089   {
00090     1,2,3,   0,2,0,
00091     1,3,4,  0,0,1
00092   };
00093  
00094   tessinitgeneral(tess,d,dsz,ti,tisz);
00095 }

void tessinitgeneral ( d3tess tess,
double const *  d,
uintc  dsz,
uintc ti,
uintc  tisz 
)

Definition at line 50 of file main.cpp.

References d3tess::debugcheck(), d3tess::pt, d3tess::reset(), and d3tess::viadd().

Referenced by tessinit03().

00057 {
00058   tess.reset();
00059 
00060   for (uint i=0; i<dsz; ++i)
00061     tess.pt.push_back( pt3(d[i*2],d[i*2+1],0.0) );
00062 
00063   uint k;
00064   for (uint i=0; i<tisz; ++i)
00065   {
00066     k=i*6;
00067     tess.viadd( ti[k], ti[k+1], ti[k+2], ti[k+3], ti[k+4], ti[k+5] );
00068   }
00069 
00070   tess.debugcheck();
00071 }

void test01 ( d3tess tess  ) 

Definition at line 199 of file main.cpp.

References d3tess::debugcheck(), and tessinit01().

00200 {
00201   tessinit01(tess);
00202 
00203   cout << endl << endl << "Split on boundary" << endl << endl;
00204   //cout << "No neighbors" << endl;
00205   //tess.splitonboundary(1,2,13);
00206 
00207   //tess.splitonboundary(1,3,13);
00208   //splitmidpoint(tess,1,3);
00209     
00210   tess.debugcheck();
00211 /*
00212   tess.splitonboundary(11,0,14);
00213   tess.debugcheck();
00214 
00215   tess.splitonboundary(3,2,16);
00216   tess.debugcheck();
00217 
00218 */
00219 
00220 
00221 }


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