Files Classes Functions Hierarchy
00001 #include <arrays.h> 00002 #include <graphmisc.h> 00003 #include <pointsdisplay.h> 00004 #include <print.h> 00005 #include <tokenizer.h> 00006 #include <visline.h> 00007 #include <vispoint2.h> 00008 #include <vispoint3.h> 00009 #include <vistest.h> 00010 00011 string vistest::doc[] = 00012 { 00013 "", 00014 "development of point2 with basic tests", 00015 "", 00016 "" 00017 }; 00018 00019 int vistest::test01(int argc, char** argv) 00020 { 00021 visenv ve(argc,argv,false); 00022 00023 bool res; 00024 viscmd c1("point2","2.0 3.0"); 00025 vispoint2().handlecommand(res,c1); 00026 assertreturnOS( ve.pi.back() == pt3(2.0,3.0,0.0) ); 00027 00028 viscmd c2("point3","1 1 1"); 00029 vispoint3().handlecommand(res,c2); 00030 assertreturnOS( ve.pi.back() == pt3(1.0,1.0,1.0) ); 00031 00032 cout << "pi" << endl; 00033 for (uint i=0; i<ve.pi.size(); ++i) 00034 cout << i << " " << ve.pi[i] << endl; 00035 00036 return 0; 00037 } 00038 00039 int vistest::test02(int argc, char** argv) 00040 { 00041 visenv ve(argc,argv); 00042 00043 string cmdarray[] = 00044 { 00045 "pointxml", "display=true", 00046 "pointxml", "colorrandom=1", 00047 "point2", "2.0 3.0", 00048 "point2", "1.0 5.0", 00049 "point2", "1.0 5.0", 00050 "point2", "2.0 1.0", 00051 // "pointxml", "colorrandom=0 colorrgb=\"0 230 0\"", 00052 "point2", "0.5 0.0", 00053 "point3", "1.0 1.0 2.0", 00054 "point3", "-1 2.0 0 -1 -2 -.5", 00055 "line", "1 2 2 3 3 4 4 1", 00056 "convex","N=2000 points=\"1 2 3 4\"" 00057 }; 00058 00059 vector<viscmd> v; 00060 arraysreadelements2(v,cmdarray,sizeof(cmdarray)/sizeof(string)/2); 00061 00062 //visdictionary::add(new vispoint2); 00063 00064 visdictionary::build01(); 00065 00066 visdictionary::process(v); 00067 00068 viscmd::printstatusinvalid(v); 00069 00070 pointsdisplay3D<pt3> dp(ve.xGraphics,ve.pi); 00071 00072 00073 /* 00074 gobjpush(new gobjglColor3f(.2,.5,.02)); 00075 point3<double> p3(0.0, 0.0, -2.0); 00076 gobjQuadric* sph = new gobjQuadric(); 00077 gobjpush(sph); 00078 sph->radius=0.04; 00079 sph->slices=40; 00080 sph->loops=8; 00081 gobjpush(new gobjMySphereDraw(p3,sph)); 00082 */ 00083 00084 ve.graphicsloop(); 00085 00086 return 0; 00087 } 00088 00089 int vistest::test03(int argc, char** argv) 00090 { 00091 visenv ve(argc,argv,false); 00092 00093 string cmdarray[] = 00094 { 00095 "point2", "2.0 3.0", 00096 // "point2", "1 1 1 2 3 7" 00097 "point2", "1 1 1 2 3 ", // false test as 5 00098 // "point2", "2.0 1.0", 00099 // "point2", "0.5 0.0" 00100 "point3", "1 1 1", 00101 "point3", "2 1 1 4 1 1 8 1 1 16 1 1" 00102 }; 00103 00104 vector<viscmd> v; 00105 arraysreadelements2(v,cmdarray,sizeof(cmdarray)/sizeof(string)/2); 00106 00107 visdictionary::add(new vispoint2); 00108 visdictionary::add(new vispoint3); 00109 visdictionary::process(v); 00110 00111 00112 00113 00114 /* 00115 00116 bool res; 00117 viscmd c1("point2","2.0 3.0"); 00118 vispoint2().handlecommand(res,c1); 00119 // assertreturnOS( ve.pi.back() == pt3(2.0,3.0,0.0) ); 00120 00121 00122 viscmd c2("point2","1 1 1 2 3 7"); 00123 vispoint2().handlecommand(res,c2); 00124 00125 // assertreturnOS( ve.pi.back() == pt3(1.0,1.0,1.0) ); 00126 00127 */ 00128 00129 cout << "pi" << endl; 00130 for (uint i=0; i<ve.pi.size(); ++i) 00131 cout << i << " " << ve.pi[i] << endl; 00132 00133 return 0; 00134 } 00135 00136 00137 00138
1.5.8