Files Classes Functions Hierarchy
#include <bsptreeD2dispregions01.h>
Public Member Functions | |
| bsptreeD2dispregions01 (bsptreeD2< PT, PD, INDX > &bsp_) | |
| Constructor initializes but does not realize. | |
| void | update () |
| Call update to write the graphics to itself. | |
Public Attributes | |
| PD | delta |
| Adjusts the region numbers away from the half-space intersection. | |
| bsptreeD2< PT, PD, INDX > & | bsp |
| The bsp tree being displayed. | |
Definition at line 14 of file bsptreeD2dispregions01.h.
| bsptreeD2dispregions01< PT, PD, INDX >::bsptreeD2dispregions01 | ( | bsptreeD2< PT, PD, INDX > & | bsp_ | ) | [inline] |
Constructor initializes but does not realize.
Definition at line 25 of file bsptreeD2dispregions01.h.
00026 : gobjContainer(true), delta(0.2), bsp(bsp_) {}
| void bsptreeD2dispregions01< PT, PD, INDX >::update | ( | ) | [inline] |
Call update to write the graphics to itself.
Definition at line 37 of file bsptreeD2dispregions01.h.
References bsptreeD2dispregions01< PT, PD, INDX >::bsp, bsptreeD2dispregions01< PT, PD, INDX >::delta, halfspaceD2< PT, PD >::intersection(), halfspaceD2< PT, PD >::normal, gobjContainer::nuke(), halfspaceD2< PT, PD >::p0, halfspaceD2< PT, PD >::p1, and gobjContainer::push().
Referenced by bsptree001::bsptree001(), treeindexedD2test::test03(), and treeindexedD2test::test05().
00038 { 00039 nuke(); 00040 00041 if (bsp.empty()) 00042 return; 00043 00044 uint sz; 00045 00046 INDX region; 00047 00048 INDX hpindex; 00049 INDX hindex; 00050 00051 00052 // gobjQuadric * q2 = new gobjQuadric(); 00053 // q2->radius = 0.05; 00054 // q2->slices=30; 00055 // q2->loops=7; 00056 00057 PT parentnormal; 00058 PT hnormal; 00059 00060 vector<PT> ptlist; 00061 vector<string> ptlabels; 00062 00063 for ( treeindexedD2iterleaf<INDX> i1(bsp.tree); !i1; ++i1) 00064 { 00065 00066 region = i1()->index; 00067 00068 //cout << SHOW(region) << endl; 00069 00070 sz = i1.path.size(); 00071 if (sz<3) 00072 { 00073 if (sz!=2) 00074 continue; 00075 00076 hindex = i1.path[0]->index; 00077 //cout << SHOW(hindex) << endl; 00078 //cout << SHOW(bsp.vi.size()) << endl; 00079 00080 assert(hindex<bsp.vi.size()); 00081 halfspaceD2<PT,PD> & h( bsp.vi[ hindex ] ); 00082 00083 PT p0 = (h.p0 + h.p1)*0.5; 00084 parentnormal=h.normal; 00085 //cout << SHOW(parentnormal) << endl; 00086 parentnormal.normalize(); 00087 parentnormal *= delta; 00088 //cout << SHOW(parentnormal) << endl; 00089 if (i1.path[0]->isright(region)) 00090 parentnormal *= -1; 00091 00092 //cout << SHOW(p0) << endl; 00093 p0 += parentnormal; 00094 //cout << SHOW(p0) << endl; 00095 00096 ptlist.push_back(p0); 00097 00098 { 00099 stringstream ss; 00100 ss << region; 00101 ptlabels.push_back(ss.str()); 00102 } 00103 00104 continue; 00105 } 00106 00107 hpindex = i1.path[sz-3]->index; 00108 hindex = i1.path[sz-2]->index; 00109 // h2 is the parent half-space of h1. 00110 halfspaceD2<PT,PD> & hp( bsp.vi[ hpindex ] ); 00111 halfspaceD2<PT,PD> & h( bsp.vi[ hindex ] ); 00112 00113 //cout << SHOW(region) << " " << SHOW(hpindex) << " " << SHOW(hindex) << endl; 00114 //cout << "hp: " << hp.print() << endl; 00115 //cout << "h: " << h.print() << endl; 00116 00117 PT p0; 00118 h.intersection(p0,hp.p0,hp.p1); 00119 00120 parentnormal=hp.normal; 00121 parentnormal.normalize(); 00122 parentnormal *= delta; 00123 //cout << SHOW(parentnormal) << endl; 00124 //cout << SHOW(i1.path[sz-3]->isrightinternal(hindex)) << endl; 00125 00126 if (i1.path[sz-3]->isrightinternal(hindex)) 00127 parentnormal *= -1; 00128 //cout << SHOW(parentnormal) << endl; 00129 00130 p0 += parentnormal; 00131 //cout << SHOW(p0) << endl; 00132 00133 hnormal = h.normal; 00134 hnormal.normalize(); 00135 hnormal *= delta; 00136 00137 if (i1.path[sz-2]->isright(region)) 00138 hnormal *= -1; 00139 00140 //cout << SHOW(hnormal) << endl; 00141 00142 p0 += hnormal; 00143 00144 //cout << SHOW(p0) << endl; 00145 //cout << endl; 00146 00147 ptlist.push_back(p0); 00148 00149 { 00150 stringstream ss; 00151 ss << region; 00152 ptlabels.push_back(ss.str()); 00153 } 00154 00155 // push(new gobjMySphereDraw(p0,q2)); 00156 00157 } 00158 00159 push(new gobjglPushAttrib(GL_LIGHTING)); 00160 push(new gobjglPushAttrib(GL_CURRENT_BIT)); 00161 00162 push(new gobjglDisable(GL_LIGHTING)); 00163 00164 push(new gobjglColor3f(1.0,0.0,0.0)); 00165 00166 pointsdisplay2D< PT > pd( *this, ptlist, ptlabels ); 00167 00168 push(new gobjglPopAttrib()); 00169 push(new gobjglPopAttrib()); 00170 }
| bsptreeD2<PT,PD,INDX>& bsptreeD2dispregions01< PT, PD, INDX >::bsp |
The bsp tree being displayed.
Definition at line 23 of file bsptreeD2dispregions01.h.
Referenced by bsptreeD2dispregions01< PT, PD, INDX >::update().
| PD bsptreeD2dispregions01< PT, PD, INDX >::delta |
Adjusts the region numbers away from the half-space intersection.
Definition at line 20 of file bsptreeD2dispregions01.h.
Referenced by bsptree001::bsptree001(), treeindexedD2test::test03(), treeindexedD2test::test05(), and bsptreeD2dispregions01< PT, PD, INDX >::update().
1.5.8