proj home

Files   Classes   Functions   Hierarchy  

bsptreeD2disp03< PT, PD, INDX > Class Template Reference

Display a bsp tree's partitions with lines, direction and initial point p0. More...

#include <bsptreeD2disp03.h>

Inheritance diagram for bsptreeD2disp03< PT, PD, INDX >:
Collaboration diagram for bsptreeD2disp03< PT, PD, INDX >:

List of all members.

Public Member Functions

 bsptreeD2disp03 (bsptreeD2< PT, PD, INDX > &bsp_, doublec radius_=0.05)
 Constructor initializes but does not realize.
void update ()
 Call update to write the graphics to itself.

Public Attributes

bsptreeD2< PT, PD, INDX > & bsp
 The bsp tree being displayed.
double radius
 The radius of the spheres at the initial points p0 and p1.


Detailed Description

template<typename PT, typename PD, typename INDX>
class bsptreeD2disp03< PT, PD, INDX >

Display a bsp tree's partitions with lines, direction and initial point p0.

The color indicates the direction. Blue is at the bottom of the line and red at the top for the half-space pointing to the left.

Definition at line 23 of file bsptreeD2disp03.h.


Constructor & Destructor Documentation

template<typename PT, typename PD, typename INDX>
bsptreeD2disp03< PT, PD, INDX >::bsptreeD2disp03 ( bsptreeD2< PT, PD, INDX > &  bsp_,
doublec  radius_ = 0.05 
) [inline]

Constructor initializes but does not realize.

Definition at line 35 of file bsptreeD2disp03.h.

00039     : gobjContainer(true), bsp(bsp_), radius(radius_) {}


Member Function Documentation

template<typename PT , typename PD , typename INDX >
void bsptreeD2disp03< PT, PD, INDX >::update (  )  [inline]

Call update to write the graphics to itself.

Definition at line 50 of file bsptreeD2disp03.h.

References bsptreeD2disp03< PT, PD, INDX >::bsp, gobjQuadric::loops, gobjContainer::nuke(), halfspaceD2< PT, PD >::p0, halfspaceD2< PT, PD >::p1, gobjContainer::push(), bsptreeD2disp03< PT, PD, INDX >::radius, gobjQuadric::radius, and gobjQuadric::slices.

Referenced by bsptree001::bsptree001(), treeindexedD2test::test03(), and treeindexedD2test::test05().

00051 {
00052   nuke();
00053 
00054   if ( bsp.empty() )
00055     return;
00056   
00057   PT La;
00058   PT Lm;
00059   PT Lb;
00060 
00061   PT Lmid;
00062   vector<string> ptlabels;
00063   vector<PT> ptlist;
00064 
00065   PD t0;
00066   PD t1;
00067 
00068   gobjQuadric * q2 = new gobjQuadric();
00069   q2->radius = radius;
00070   q2->slices=30;
00071   q2->loops=7;
00072 
00073   push(q2);
00074 
00075   push(new gobjglPushAttrib(GL_LIGHTING));
00076   push(new gobjglPushAttrib(GL_CURRENT_BIT));
00077 
00078   for ( treeindexedD2iterinternal<INDX> i1(bsp.tree); 
00079     !i1; ++i1 )
00080   {
00081     halfspaceD2<PT,PD> & h1(bsp.vi[i1()->index]);
00082 
00083     Lm = h1.p1-h1.p0;
00084     La = h1.p0;
00085     Lb = h1.p1;
00086 
00087     //t0 = tmin;
00088     //t1 = tmax;
00089     t0 = bsp.tmin;
00090     t1 = bsp.tmax;
00091 
00092     Lmid = (La+Lb)*0.5;
00093     ptlist.push_back(Lmid);
00094     { 
00095       stringstream ss; 
00096       INDX idx = i1()->index;
00097       ss << idx; 
00098       ptlabels.push_back(ss.str());
00099     }
00100 
00101     uint sz = i1.path.size();
00102     if (sz<=1)
00103     {
00104       if (sz==0)
00105         continue;
00106 
00107       push(new gobjglDisable(GL_LIGHTING));
00108       push(new gobjglBegin(GL_LINES));
00109       push(new gobjglColor3f(0.0,0.0,1.0));
00110       push(new gobjglVertex3d(La+Lm*t0));
00111       push(new gobjglColor3f(1.0,0.0,0.0));
00112       push(new gobjglVertex3d(La+Lm*t1));
00113       push(new gobjglEnd());      
00114 
00115       push(new gobjglEnable(GL_LIGHTING));
00116       push(new gobjglColor3f(0.0,0.0,1.0));
00117       push(new gobjMySphereDraw(La,q2));
00118       push(new gobjglColor3f(1.0,0.0,0.0));
00119       push(new gobjMySphereDraw(Lb,q2));
00120 
00121       continue;
00122     }
00123 
00124     bsp.clip(t0,t1,La,Lm,i1);
00125 
00126     push(new gobjglDisable(GL_LIGHTING));
00127     push(new gobjglBegin(GL_LINES));
00128     push(new gobjglColor3f(0.0,0.0,1.0));
00129     push(new gobjglVertex3d(La+Lm*t0));
00130     push(new gobjglColor3f(1.0,0.0,0.0));
00131     push(new gobjglVertex3d(La+Lm*t1));
00132     push(new gobjglEnd());
00133 
00134     push(new gobjglEnable(GL_LIGHTING));
00135     push(new gobjglColor3f(0.0,0.0,1.0));
00136     push(new gobjMySphereDraw(La,q2));
00137     push(new gobjglColor3f(1.0,0.0,0.0));
00138     push(new gobjMySphereDraw(Lb,q2));
00139   }
00140 
00141   push(new gobjglDisable(GL_LIGHTING));
00142   push(new gobjglColor3f(1.0,1.0,0.0));
00143   pointsdisplay2D< PT > pd( *this, ptlist, ptlabels );
00144 
00145   push(new gobjglPopAttrib());
00146   push(new gobjglPopAttrib());
00147 }


Member Data Documentation

template<typename PT, typename PD, typename INDX>
bsptreeD2<PT,PD,INDX>& bsptreeD2disp03< PT, PD, INDX >::bsp

The bsp tree being displayed.

Definition at line 28 of file bsptreeD2disp03.h.

Referenced by bsptreeD2disp03< PT, PD, INDX >::update().

template<typename PT, typename PD, typename INDX>
double bsptreeD2disp03< PT, PD, INDX >::radius

The radius of the spheres at the initial points p0 and p1.

Definition at line 31 of file bsptreeD2disp03.h.

Referenced by bsptreeD2disp03< PT, PD, INDX >::update().


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

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