Files Classes Functions Hierarchy
#include <bsptree001.h>
Public Types | |
| typedef point2< double > | pt2 |
Public Member Functions | |
| bsptree001 (int argc, char **argv) | |
| Visually see and interact with a bsp tree. | |
| void | currentsphere () |
| void | bspbuild () |
| Builing a simple 2D partition. | |
Static Public Member Functions | |
| static void | update () |
| Update test03. | |
| static void | keyboard (unsigned char key, int x, int y) |
| Update the moving ball in test03. | |
| static void | special (int key, int x, int y) |
| Special character keyboard handler. | |
| static void | display () |
| Displays the gobj::global with double buffering. | |
Public Attributes | |
| bsptreeD2< pt2, double, uint > | bsp |
| double | keyboarddelta |
| Change in keyboard. | |
| point2< double > | spherepos |
| Position of sphere. | |
| gobjQuadric | spherequadric |
Static Public Attributes | |
| static string | doc [] |
| Brief description of each test. | |
| static bsptree001 * | scene = 0 |
Definition at line 12 of file bsptree001.h.
| typedef point2<double> bsptree001::pt2 |
Definition at line 23 of file bsptree001.h.
| bsptree001::bsptree001 | ( | int | argc, | |
| char ** | argv | |||
| ) |
Visually see and interact with a bsp tree.
Definition at line 15 of file bsptree001.cpp.
References bsp, bspbuild(), bsptreeD2dispregions01< PT, PD, INDX >::delta, display(), gobjpush, keyboard(), keyboarddelta, gobjQuadric::loops, gobjQuadric::radius, scene, gobjContainer::set(), gobjQuadric::slices, spherequadric, zpr::update(), update(), bsptreeD2dispregions01< PT, PD, INDX >::update(), and bsptreeD2disp03< PT, PD, INDX >::update().
00016 { 00017 glutInit(&argc,argv); 00018 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00019 glutInitWindowSize(800,600); 00020 glutCreateWindow(""); 00021 glutDisplayFunc(display); 00022 glutKeyboardFunc(keyboard); 00023 00024 OpenGLinitialisation(); 00025 glEnable(GL_CULL_FACE); 00026 glEnable(GL_NORMALIZE); 00027 00028 xGraphics.set(); 00029 00030 scene = this; 00031 00032 keyboarddelta = 0.1; 00033 00034 spherequadric.radius = 0.2; 00035 spherequadric.slices = 30; 00036 spherequadric.loops = 7; 00037 00038 commandline cmd(argc,argv); 00039 00040 bspbuild(); 00041 00042 bsptreeD2disp03<pt2,double,uint> * disp 00043 = new bsptreeD2disp03<pt2,double,uint>(bsp,0.02); 00044 disp->update(); 00045 gobjpush(disp); 00046 00047 bsptreeD2dispregions01<pt2,double,uint> *dispregions 00048 = new bsptreeD2dispregions01<pt2,double,uint>(bsp); 00049 dispregions->delta=0.4; 00050 dispregions->update(); 00051 gobjpush(dispregions); 00052 00053 update(); 00054 00055 00056 zpr zz; 00057 zz.update(); 00058 00059 glutMainLoop(); 00060 00061 00062 }
| void bsptree001::bspbuild | ( | ) |
Builing a simple 2D partition.
Definition at line 105 of file bsptree001.cpp.
References bsptreeD2< PT, PD, INDX >::addleft(), bsptreeD2< PT, PD, INDX >::addright(), bsptreeD2< PT, PD, INDX >::addroot(), and bsp.
Referenced by bsptree001().
00106 { 00107 cout << "Building a simple 2D partition." << endl; 00108 cout << " Using manual insertion commands : move to the node before" << endl; 00109 cout << " inserting new node, then adding associated half-space to vi." << endl << endl; 00110 00111 bsp.addroot( halfspaceD2<pt2,double>(pt2(0.0,0.0),pt2(0.0,1.0)) ); 00112 bsp.addleft( 0,0,halfspaceD2<pt2,double>(pt2(-1.0,1.0),pt2(0.0,1.0)) ); 00113 bsp.addright( 0,0,halfspaceD2<pt2,double>(pt2(0.0,-0.5),pt2(1.0,-0.5)) ); 00114 bsp.addleft( 1*1,1,halfspaceD2<pt2,double>(pt2(4.0,0.0),pt2(4.0,1.0)) ); 00115 }
| void bsptree001::currentsphere | ( | ) |
Definition at line 134 of file bsptree001.cpp.
References assertreturn, bsp, bsptreeD2< PT, PD, INDX >::find(), gobjpush, scene, spherepos, and spherequadric.
00135 { 00136 assertreturn(scene!=0); 00137 00138 uint i; 00139 scene->bsp.find(i,scene->spherepos); 00140 switch (i) 00141 { 00142 case 1: gobjpush(new gobjglColor3ub(220,20,60)); break; 00143 case 2: gobjpush(new gobjglColor3ub(0,206,209)); break; 00144 case 3: gobjpush(new gobjglColor3ub(255,140,0)); break; 00145 case 4: gobjpush(new gobjglColor3ub(143,188,139)); break; 00146 case 5: gobjpush(new gobjglColor3ub(184,134,11)); break; 00147 00148 default: 00149 gobjpush(new gobjglColor3ub(255,0,0)); 00150 } 00151 00152 gobjpush 00153 ( 00154 new gobjMySphereDraw 00155 ( 00156 scene->spherepos, 00157 scene->spherequadric 00158 ) 00159 ); 00160 00161 }
| void bsptree001::display | ( | ) | [static] |
Displays the gobj::global with double buffering.
Definition at line 163 of file bsptree001.cpp.
References gobjContainer::draw(), glerrordisplay(), and gobj::global.
Referenced by bsptree001().
00164 { 00165 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00166 00167 gobj::global->draw(); 00168 glerrordisplay(); 00169 00170 glutSwapBuffers(); 00171 }
| void bsptree001::keyboard | ( | unsigned char | key, | |
| int | x, | |||
| int | y | |||
| ) | [static] |
Update the moving ball in test03.
Definition at line 81 of file bsptree001.cpp.
Referenced by bsptree001().
00086 { 00087 switch (key) 00088 { 00089 case 27: exit(0); break; 00090 00091 /* 00092 case '+': scene->keyboarddelta *= 10.0; 00093 if (scene->keyboarddelta==0.0) 00094 scene->keyboarddelta=0.1; 00095 break; 00096 case '-': scene->keyboarddelta /= 10.0; break; 00097 00098 case 'h': if (help!=0) *help = !*help; break; 00099 */ 00100 } 00101 00102 update(); 00103 }
| void bsptree001::special | ( | int | key, | |
| int | x, | |||
| int | y | |||
| ) | [static] |
Special character keyboard handler.
Definition at line 65 of file bsptree001.cpp.
References assertreturn, keyboarddelta, scene, spherepos, update(), point2< T >::x, and point2< T >::y.
00066 { 00067 assertreturn(scene!=0); 00068 00069 switch (key) 00070 { 00071 case GLUT_KEY_RIGHT : scene->spherepos.x += scene->keyboarddelta; break; 00072 case GLUT_KEY_LEFT : scene->spherepos.x -= scene->keyboarddelta; break; 00073 case GLUT_KEY_UP : scene->spherepos.y += scene->keyboarddelta; break; 00074 case GLUT_KEY_DOWN : scene->spherepos.y -= scene->keyboarddelta; break; 00075 } 00076 00077 scene->update(); 00078 }
| void bsptree001::update | ( | ) | [static] |
Update test03.
Definition at line 118 of file bsptree001.cpp.
References assertreturn, and scene.
Referenced by bsptree001(), and special().
00119 { 00120 assertreturn(scene!=0); 00121 00122 00123 00124 /* 00125 targetg->push(targetsphere); 00126 00127 targetsphere->x = target.x; 00128 targetsphere->y = target.y; 00129 00130 glutPostRedisplay(); 00131 */ 00132 }
| bsptreeD2<pt2,double,uint> bsptree001::bsp |
Definition at line 25 of file bsptree001.h.
Referenced by bspbuild(), bsptree001(), and currentsphere().
string bsptree001::doc [static] |
Initial value:
{
"",
""
}
Definition at line 19 of file bsptree001.h.
Referenced by main().
| double bsptree001::keyboarddelta |
Change in keyboard.
Definition at line 28 of file bsptree001.h.
Referenced by bsptree001(), and special().
bsptree001 * bsptree001::scene = 0 [static] |
Definition at line 21 of file bsptree001.h.
Referenced by bsptree001(), currentsphere(), special(), and update().
| point2<double> bsptree001::spherepos |
Position of sphere.
Definition at line 31 of file bsptree001.h.
Referenced by currentsphere(), and special().
1.5.8