Files Classes Functions Hierarchy
#include <cpsphere.h>
Public Member Functions | |
| void | stateinc () |
| The current state is incremented and the graphics is updated. | |
| void | statedec () |
| The current state is decremented and the graphics is updated. | |
| cpsphere (vector< point3< double > > const &pts_, vector< point4< uint > > const &vi_) | |
| Initialize this classes data structures with conditions such that the points and indexed tet vectors must exist. | |
| ~cpsphere () | |
| Memory cleanup. | |
| void | update () |
| The current graphics are re-written so that a sphere through the current tet's 4 points is drawn. | |
Public Attributes | |
| vector< point3< double > > const & | pts |
| The array of points. | |
| vector< point4< uint > > const & | vi |
| Represent a tetrahedron as 4 indexes to the array of points. | |
| gobjContainer * | current |
| The graphics. | |
| uint | state |
| The state indexes into vi. | |
Definition at line 14 of file cpsphere.h.
| cpsphere::cpsphere | ( | vector< point3< double > > const & | pts_, | |
| vector< point4< uint > > const & | vi_ | |||
| ) |
Initialize this classes data structures with conditions such that the points and indexed tet vectors must exist.
Definition at line 95 of file cpsphere.cpp.
00099 : pts(pts_), vi(vi_), state(0) 00100 { 00101 current = new gobjContainer(); 00102 }
| cpsphere::~cpsphere | ( | ) |
Memory cleanup.
Definition at line 104 of file cpsphere.cpp.
References current.
00105 { 00106 delete current; 00107 }
| void cpsphere::statedec | ( | ) |
The current state is decremented and the graphics is updated.
Definition at line 21 of file cpsphere.cpp.
References state, update(), and vi.
Referenced by keyboard().
00022 { 00023 uint sz = vi.size(); 00024 if (sz==0) 00025 return; 00026 00027 state += (sz-1); 00028 state %= sz; 00029 00030 update(); 00031 }
| void cpsphere::stateinc | ( | ) |
The current state is incremented and the graphics is updated.
Definition at line 12 of file cpsphere.cpp.
References state, update(), and vi.
Referenced by keyboard().
00013 { 00014 //cout << "state=" << state << endl; 00015 ++state; 00016 state %= vi.size(); 00017 00018 update(); 00019 }
| void cpsphere::update | ( | ) |
The current graphics are re-written so that a sphere through the current tet's 4 points is drawn.
Definition at line 33 of file cpsphere.cpp.
References tetrahedron< PT, PD >::circumcenter(), current, gobjContainer::nuke(), pts, gobjContainer::push(), state, and vi.
Referenced by statedec(), stateinc(), test02(), and test03().
00034 { 00035 current->nuke(); 00036 00037 uintc imax = vi.size(); 00038 00039 if ((state<imax)==false) 00040 return; 00041 00042 // Calculate the spheres details. 00043 00044 uintc slices=30; 00045 uintc stacks=30; 00046 00047 point3<double> const & P1( pts[ vi[state].x ] ); 00048 point3<double> const & P2( pts[ vi[state].y ] ); 00049 point3<double> const & P3( pts[ vi[state].z ] ); 00050 point3<double> const & P4( pts[ vi[state].w ] ); 00051 00052 tetrahedron<point3<double>,double> const t(P1,P2,P3,P4); 00053 point3<double> c0; 00054 t.circumcenter(c0); 00055 point3<double> const c(c0); 00056 doublec radius = (c-P1).distance(); 00057 00058 // Write the graphics. 00059 00060 current->push( new gobjglPushMatrix() ); 00061 00062 00063 current->push( new gobjglEnable(GL_LIGHTING) ); 00064 00065 /* 00066 current->push( new gobjglColor3f(1.0,0.0,0.0) ); 00067 00068 00069 current->push( new gobjglTranslatef(c) ); 00070 current->push( 00071 new gobjglutSolidSphere(radius,slices,stacks) ); 00072 */ 00073 00074 00075 00076 current->push( new gobjglDisable(GL_DEPTH_TEST) ); 00077 current->push( new gobjglEnable(GL_BLEND) ); 00078 current->push( 00079 new gobjglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ); 00080 00081 current->push( new gobjglColor4f(1.0,0.0,0.0,0.8) ); 00082 00083 current->push( new gobjglTranslatef(c) ); 00084 current->push( 00085 new gobjglutSolidSphere(radius,slices,stacks) ); 00086 00087 00088 current->push( new gobjglPopMatrix() ); 00089 00090 00091 //glerrordisplay(); 00092 }
The graphics.
Definition at line 24 of file cpsphere.h.
Referenced by test02(), test03(), update(), and ~cpsphere().
| vector< point3<double> > const& cpsphere::pts |
The state indexes into vi.
Definition at line 27 of file cpsphere.h.
Referenced by statedec(), stateinc(), and update().
| vector< point4<uint> > const& cpsphere::vi |
Represent a tetrahedron as 4 indexes to the array of points.
Definition at line 21 of file cpsphere.h.
Referenced by statedec(), stateinc(), and update().
1.5.8