Files Classes Functions Hierarchy
#include <windowscaleD2test.h>
Public Member Functions | |
| void | test002 (int argc, char **argv) |
| funcA1 (y01,-x *x+1.0, x, double, double) | |
| Tempory function. | |
| funcA1 (y02, sin(x), x, double, double) | |
| funcA1 (y03, 5.0/x, x, double, double) | |
| funcA1 (y04, cos(x), x, double, double) | |
Static Public Member Functions | |
| static int | test001 (int argc, char **argv) |
| Basic tests converting between 2D windows on windowscaleD2 class. | |
Public Attributes | |
| y04 | f04 |
| double | f04time |
| double | f04timedx |
| pointsgraphtime * | f04pg |
Static Public Attributes | |
| static string | doc [] |
| Brief description of each test. | |
| static windowscaleD2test * | windowtest = 0 |
Definition at line 15 of file windowscaleD2test.h.
| windowscaleD2test::funcA1 | ( | y04 | , | |
| cos(x) | , | |||
| x | , | |||
| double | , | |||
| double | ||||
| ) |
| windowscaleD2test::funcA1 | ( | y03 | , | |
| 5.0/ | x, | |||
| x | , | |||
| double | , | |||
| double | ||||
| ) |
| windowscaleD2test::funcA1 | ( | y02 | , | |
| sin(x) | , | |||
| x | , | |||
| double | , | |||
| double | ||||
| ) |
| windowscaleD2test::funcA1 | ( | y01 | , | |
| -x *x+1. | 0, | |||
| x | , | |||
| double | , | |||
| double | ||||
| ) |
Tempory function.
| int windowscaleD2test::test001 | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Basic tests converting between 2D windows on windowscaleD2 class.
Definition at line 21 of file windowscaleD2test.cpp.
References assertreturnOS, windowscaleD2::convertfrom(), windowscaleD2::isinside(), windowscaleD2::scalexy(), windowscaleD2::serializeInverse(), SHOW, windowscaleD2::unitcentered, and windowscaleD2::unitwindow().
Referenced by main().
00022 { 00023 windowscaleD2 w1; 00024 w1.unitwindow(); 00025 00026 assertreturnOS( w1.isinside(.2,.7) ); 00027 assertreturnOS( ! w1.isinside(-.2,.7) ); 00028 00029 string s1(".2 -1 5.7 8"); 00030 windowscaleD2 w2; 00031 w2.serializeInverse(s1); 00032 cout << "w2=" << (stringc)w2 << endl; 00033 00034 windowscaleD2 w3 = windowscaleD2::unitcentered; 00035 w3.scalexy(2.0); 00036 w3.update(); 00037 cout << "w3=" << (stringc) w3 << endl; 00038 00039 double x; 00040 double y; 00041 x=-1.0; 00042 y=-1.0; 00043 cout << SHOW(x) << " " << SHOW(y) << endl; 00044 cout << "Convert from window w3 to w2" << endl; 00045 w2.convertfrom(x,y,w3); 00046 cout << SHOW(x) << " " << SHOW(y) << endl; 00047 assertreturnOS( x==.2); 00048 assertreturnOS( y==-1); 00049 00050 x=1.0; 00051 y=1.0; 00052 cout << SHOW(x) << " " << SHOW(y) << endl; 00053 cout << "Convert from window w3 to w2" << endl; 00054 w2.convertfrom(x,y,w3); 00055 cout << SHOW(x) << " " << SHOW(y) << endl; 00056 assertreturnOS( x==5.7); 00057 assertreturnOS( y==8); 00058 00059 return 0; 00060 }
| void windowscaleD2test::test002 | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 122 of file windowscaleD2test.cpp.
References pointsgraph::clipwindow, pointsgraph::domain(), f04, f04pg, f04time, f04timedx, gobjpush, pointsgraph::isinside, commandline::mapvar(), pointsgraph::pts, pointsgraphtime::push_back(), pointsgraph::samplefunction(), pointsgraph::screen, pointsgraph::screen_rescaley(), gobjContainer::set(), windowscaleD2::shiftxy(), SHOW, zpr::update(), pointsgraph_axes_circle::update(), pointsgraph::update(), windowtest, pointsgraph::world, pointsgraph_axes_circle::xaxis, windowscaleD2::xmax, windowscaleD2::xmin, and pointsgraph_axes_circle::yaxis.
00123 { 00124 glutInit(&argc,argv); 00125 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00126 glutInitWindowSize(600,600); 00127 glutCreateWindow(""); 00128 glutDisplayFunc(display01); 00129 glutKeyboardFunc(keyboard01); 00130 00131 OpenGLinitialisation(); 00132 00133 glEnable(GL_DEPTH_TEST); 00134 glEnable(GL_CULL_FACE); 00135 glEnable(GL_NORMALIZE); 00136 00137 xGraphics.set(); 00138 00139 //pointsgraph* pg = new pointsgraph(); 00140 //pg->screen.construct(-1.0,-2.0,1.0,2.0); 00141 //pg->world.construct(0.0,0.0,2.0,2.0); 00142 pointsgraph* pg = new pointsgraph( 00143 windowscaleD2(-1.0,-2.0,1.0,2.0), 00144 windowscaleD2(0.0,0.0,2.0,2.0)); 00145 00146 commandline cmd(argc,argv); 00147 00148 int graph=1; 00149 cmd.mapvar(graph,"graph"); 00150 00151 switch (graph) 00152 { 00153 case 1: 00154 { 00155 // y =1-x^2 x=[-1,1] 00156 y01 f01; 00157 pg->samplefunction(f01,1000); 00158 } 00159 break; 00160 00161 case 2: 00162 { 00163 y01 f01; 00164 pg->samplefunction(f01,1000); 00165 //for (uint i=0; i<pg->pts.size(); ++i) 00166 // { cout << i << ": " << pg->pts[i] << endl; } 00167 00168 //cout << SHOW((stringc)(pg->screen)) << endl; 00169 pg->world.shiftxy((double)-1.0,(double)-1.0); 00170 pg->screen_rescaley(); 00171 } 00172 break; 00173 00174 case 3: 00175 { 00176 y02 f01; 00177 pg->screen.xmin=0; 00178 pg->screen.xmax=PI*2; 00179 pg->samplefunction(f01,200); 00180 pg->world.shiftxy((double)-1.0,(double)-1.0); 00181 pg->screen_rescaley(); 00182 for (uint i=0; i<pg->pts.size(); ++i) 00183 { cout << i << ": " << pg->pts[i] << endl; } 00184 cout << SHOW((stringc)(pg->screen)) << endl; 00185 } 00186 break; 00187 00188 case 4: 00189 { 00190 // Turned off with singularity. 00191 pointsgraph::isinside=false; 00192 y03 f01; 00193 double h=3.0; 00194 pg->domain(-h,h); 00195 pg->samplefunction(f01,8); 00196 pg->world.shiftxy((double)-1.0,(double)-1.0); 00197 // pg->screen_rescaley(); 00198 for (uint i=0; i<pg->pts.size(); ++i) 00199 { cout << i << ": " << pg->pts[i] << endl; } 00200 }; 00201 00202 case 5: 00203 { 00204 y02 f01; 00205 pg->domain(-PI*3,PI*3); 00206 pg->samplefunction(f01,200); 00207 pg->domain(-PI*0.5,PI*0.5); 00208 pg->clipwindow=true; 00209 pg->world.shiftxy((double)-1.0,(double)-1.0); 00210 pg->screen_rescaley(); 00211 for (uint i=0; i<pg->pts.size(); ++i) 00212 { cout << i << ": " << pg->pts[i] << endl; } 00213 cout << SHOW((stringc)(pg->screen)) << endl; 00214 cout << "Function with larger domain created." << endl; 00215 cout << " Displaying a section of the sin graph." << endl; 00216 } 00217 break; 00218 00219 case 6: 00220 { 00221 windowtest=this; 00222 00223 delete pg; 00224 f04pg = new pointsgraphtime(10); 00225 pg = f04pg; 00226 pg->screen = 00227 windowscaleD2(0.0,-1.0,1.0,1.0); 00228 pg->world = 00229 windowscaleD2(-1.0,-1.0,1.0,1.0); 00230 pg->update(); 00231 00232 f04time=0.0; 00233 f04pg->push_back( f04(f04time) ); 00234 f04timedx=0.1; 00235 00236 } 00237 break; 00238 00239 } 00240 00241 /* 00242 uint N=10; 00243 double dx = 1.0; 00244 dx /= (N-1); 00245 00246 double x; 00247 double y; 00248 for (uint i=0; i<N; ++i) 00249 { 00250 x = dx*i; 00251 pg->screen.unitscaleInverse_x(x); 00252 f01(y,x); 00253 00254 pg->pts.push_back( point2<double>(x,y) ); 00255 } 00256 */ 00257 00258 gobjpush(new gobjglPushAttrib(GL_CURRENT_BIT)); 00259 gobjpush(new gobjglPushAttrib(GL_LIGHTING_BIT)); 00260 gobjpush(new gobjglColor3d(1.0,.02,.13)); 00261 gobjpush(new gobjglDisable(GL_LIGHTING)); 00262 gobjpush(pg); 00263 gobjpush(new gobjglPopAttrib()); 00264 gobjpush(new gobjglPopAttrib()); 00265 00266 pointsgraph_axes_circle* a2 = new pointsgraph_axes_circle(); 00267 double xval[] = { 0,1,2,-1,-2 }; 00268 copy(xval,xval+5,back_inserter(a2->xaxis)); 00269 double yval[] = { 1,2,-1,-2 }; 00270 copy(yval,yval+4,back_inserter(a2->yaxis)); 00271 a2->update(); 00272 gobjpush(a2); 00273 00274 00275 zpr zz; 00276 zz.update(); 00277 glutMainLoop(); 00278 }
string windowscaleD2test::doc [static] |
Initial value:
{
"",
"Basic tests converting between 2D windows on windowscaleD2 class.",
""
}
Definition at line 26 of file windowscaleD2test.h.
Referenced by main().
| double windowscaleD2test::f04time |
| double windowscaleD2test::f04timedx |
windowscaleD2test * windowscaleD2test::windowtest = 0 [static] |
1.5.8