Files Classes Functions Hierarchy
#include <cassert>#include <iostream>#include <fstream>#include <GL/glut.h>#include <GL/gl.h>#include <arc.h>#include <arcdraw.h>#include <arcsconnected.h>#include <arcsdef.h>#include <arcprob.h>#include <commandline.h>#include <farcmin01.h>#include <gobj.h>#include <graphmisc.h>#include <openwindowresource.h>#include <pathlinesegtest.h>#include <zpr.h>
Go to the source code of this file.
Functions | |
| void | print (vector< arc > const &v) |
| void | writearcgeometry (int argc, char **&argv) |
| void | prog01 (int argc, char **&argv) |
| void | test01 () |
| void | test02 () |
| void | test03 () |
| void | test04 () |
| void | test05 (int argc, char **&argv) |
| void | test06 () |
| void | test07 (int argc, char **&argv) |
| void | displayarcsfileformat () |
| void | test08 () |
| int | main (int argc, char **argv) |
| void displayarcsfileformat | ( | ) |
Definition at line 221 of file main.cpp.
Referenced by main().
00222 { 00223 cout << "Displaying the Arcs File Format" << endl; 00224 cout << endl; 00225 cout << " Format for filearcs: This is a text file containing a list" << endl; 00226 cout << " of points and arcs. An arc is described by three parameters" << endl; 00227 cout << " i j radius where i and j are indexes into the list of points." << endl; 00228 cout << " The arc is on the right of line ij if the radius is +ve, " << endl; 00229 cout << " left if the radius is -ve." << endl; 00230 cout << endl; 00231 cout << " Here is an example of the filearc file." << endl; 00232 cout << endl; 00233 00234 cout << "3" << endl; 00235 cout << "0.0 0.0" << endl; 00236 cout << "1.0 1.1" << endl; 00237 cout << "1.5 2.8" << endl; 00238 cout << "2" << endl; 00239 cout << "0 1 2.5" << endl; 00240 cout << "1 2 -2.5" << endl; 00241 cout << endl; 00242 00243 cout << " The first number is the number of points to be read in." << endl; 00244 cout << " After the 2D points comes the number of arcs to be read" << endl; 00245 cout << " Each arc indexes to two points and has a signed radius" << endl; 00246 cout << endl; 00247 }
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 263 of file main.cpp.
References displayarcsfileformat(), pathlinesegtest::doc, help(), commandline::mapvar(), prog01(), pathlinesegtest::test01(), pathlinesegtest::test02(), pathlinesegtest::test03(), test04(), test05(), test06(), test07(), test08(), and pathlinesegtest::unittest01().
00264 { 00265 commandline cmd(argc,argv); 00266 uint prog(0); 00267 cmd.mapvar(prog,"prog"); 00268 00269 bool help(false); 00270 cmd.mapvar(help,"help"); 00271 if (help==true) 00272 { 00273 displayarcsfileformat(); 00274 } 00275 00276 switch (prog) 00277 { 00278 case 0: 00279 cout << "Test programs for arc workspace" << endl << endl; 00280 00281 cout << "$./main prog=1 filearcs=<pa03.txt> " << endl; 00282 cout << " Display 2D arcs in file filearcs." << endl; 00283 00284 cout << "$./main prog=5" << endl; 00285 cout << " Constructing connected arcs" << endl; 00286 cout << "$./main prog=6" << endl; 00287 cout << " Testing the distance from a point to an arc." << endl; 00288 cout << "$/.main prog=7 fileprob=<pb01.txt> filearcs=<pa04.txt>" << endl; 00289 cout << " Testing initial condition solution" << endl; 00290 cout << "$./main prog=8" << endl; 00291 cout << " Looking at initial angle and 2 points construction." << endl; 00292 cout << "$./main prog=30 " << pathlinesegtest::doc[1] << endl; 00293 cout << "$./main prog=31 " << pathlinesegtest::doc[2] << endl; 00294 cout << "$./main prog=32 " << pathlinesegtest::doc[3] << endl; 00295 cout << "$./main prog=33 " << pathlinesegtest::doc[4] << endl; 00296 00297 00298 cout << "./main help=true" << endl; 00299 cout << " Display info such as the arc file formats." << endl; 00300 00301 break; 00302 00303 case 1: prog01(argc,argv); break; 00304 00305 case 4: test04(); break; 00306 case 5: test05(argc,argv); break; 00307 case 6: test06(); break; 00308 case 7: test07(argc,argv); break; 00309 case 8: test08(); break; 00310 00311 case 30: pathlinesegtest::test01(argc,argv); break; 00312 case 31: pathlinesegtest::test02(); break; 00313 case 32: return pathlinesegtest::unittest01(argc,argv); 00314 case 33: pathlinesegtest::test03(argc,argv); break; 00315 00316 default: cout << "error: No case handled." << endl; return 1; 00317 } 00318 00319 00320 return 0; 00321 }
| void print | ( | vector< arc > const & | v | ) |
Definition at line 29 of file main.cpp.
Referenced by cirbuffarrtest01(), cirbuffarrtest02(), cell::eval(), minimizecomparetest01(), operator<<(), printvecfunc(), singletontest01(), vrmltest::test01(), snakesorttest::test01(), printtest::test01(), vectest::test01(), triangles3Tdisplaytest::test01(), edgeTtest::test01(), hashtabletest::test01(), buckettest::test01(), test01(), mathlibtest::test010(), stringserializationtest::test02(), printtest::test02(), gausselimtest::test02(), test02(), quickhull2Dtest::test03(), mathlibtest::test03(), test03(), hashtabletest::test07(), test07(), misclib_testcode::tokenizertest::unittest01(), linechoppedtest::unittest01(), systemcallstest::unittest01(), linechoppedtest::unittest02(), misclib_testcode::tokenizertest::unittest03(), and writearcgeometry().
00030 { 00031 cout << endl << endl; 00032 cout << "Printing the arcs" << endl; 00033 for (uint i=0; i<v.size(); ++i) 00034 v[i].print(); 00035 }
| void prog01 | ( | int | argc, | |
| char **& | argv | |||
| ) |
Definition at line 68 of file main.cpp.
References writearcgeometry().
Referenced by main().
00069 { 00070 00071 openwindowresource window(argc,argv); 00072 00073 writearcgeometry(argc,argv); 00074 00075 00076 }
| void test01 | ( | ) |
Definition at line 78 of file main.cpp.
References point2< T >::normalize(), point2< T >::x, and point2< T >::y.
Referenced by main().
00079 { 00080 cout << "Looking at the atan2 function" << endl; 00081 cout << "Really asking the question that given a point" << endl; 00082 cout << "on a unit circle what is its angle." << endl; 00083 cout << endl; 00084 double phi; 00085 cout << "Enter phi(degrees): "; 00086 cin >> phi; 00087 phi *= PI/180.0; 00088 00089 pt2 p0(cos(phi),sin(phi)); 00090 p0.normalize(); 00091 cout << p0 << endl; 00092 double theta; 00093 theta = atan2(p0.y,p0.x); 00094 cout << theta << endl; 00095 cout << theta*180.0/PI << endl; 00096 }
| void test02 | ( | ) |
| void test03 | ( | ) |
Definition at line 105 of file main.cpp.
References arc::arcreader().
Referenced by main().
00106 { 00107 vector<arc> v; 00108 00109 arc::arcreader(v,"pa03.txt"); 00110 00111 for (uint i=0; i<v.size(); ++i) 00112 { 00113 cout << v[i].p0 << " " << v[i].p1 << " "; 00114 cout << v[i].radius << endl; 00115 } 00116 00117 }
| void test04 | ( | ) |
Definition at line 119 of file main.cpp.
References arc::constructPhi0TwoPoints(), arc::phi1, arc::print(), pts, radtodeg, and SHOW.
Referenced by main().
00120 { 00121 vector<pt2> pts; 00122 pts.push_back( pt2(0.0,0.0) ); 00123 pts.push_back( pt2(1.0,1.1) ); 00124 pts.push_back( pt2(1.5,2.8) ); 00125 00126 00127 arc a1(2.5,pts[0],pts[1]); 00128 00129 cout << "a1" << endl; 00130 a1.print(); 00131 00132 double theta0 = a1.phi1 + PI; 00133 if (theta0 > 2.0*PI) 00134 theta0 -= 2.0*PI; 00135 00136 cout << SHOW(a1.phi1*radtodeg) << endl; 00137 cout << SHOW(theta0*radtodeg) << endl; 00138 00139 arc a2; 00140 a2.constructPhi0TwoPoints(theta0,pts[1],pts[2]); 00141 00142 //cout << "a2" << endl; 00143 //a2.print(); 00144 00145 }
| void test05 | ( | int | argc, | |
| char **& | argv | |||
| ) |
Definition at line 147 of file main.cpp.
References gobj::global, pts, and gobjContainer::push().
Referenced by main().
00148 { 00149 cout << "Constructing connected arcs" << endl; 00150 openwindowresource window(argc,argv); 00151 00152 vector<pt2> pts; 00153 pts.push_back( pt2(0.0,0.0) ); 00154 pts.push_back( pt2(1.0,1.1) ); 00155 pts.push_back( pt2(1.5,2.8) ); 00156 pts.push_back( pt2(2.8,4.2) ); 00157 00158 pts.push_back( pt2(4.8,4.0) ); 00159 pts.push_back( pt2(6.8,4.2) ); 00160 pts.push_back( pt2(8.1,5.5) ); 00161 00162 00163 arcsconnected ac(3,pts.size()-1); 00164 00165 ac.constructR0(2.5,pts); 00166 00167 uintc N = ac.vi.size(); 00168 vector<arc> & vi(ac.vi); 00169 00170 00171 for (uint i=0; i<N; ++i) 00172 { 00173 arcdraw *ad = new arcdraw(vi[i]); 00174 gobj::global->push(ad); 00175 } 00176 00177 //print(vi); 00178 }
| void test06 | ( | ) |
Definition at line 181 of file main.cpp.
References arc::distance(), arc::print(), and SHOW.
Referenced by main().
00182 { 00183 cout << "Testing the distance from any point to an arc" << endl; 00184 00185 pt2 p0(1.0,0.0); 00186 pt2 p1(0.0,1.0); 00187 00188 arc a1(1.0,p0,p1); 00189 a1.print(); 00190 00191 cout << "Enter a point" << endl; 00192 pt2 p2(0.0,1.0); 00193 cin >> p2; 00194 double dist(0.0); 00195 a1.distance(dist,p2); 00196 cout << SHOW(dist) << endl; 00197 00198 }
| void test07 | ( | int | argc, | |
| char **& | argv | |||
| ) |
Definition at line 200 of file main.cpp.
References arcprob::ac, arcsconnected::arcwriter(), print(), and arcsconnected::vi.
Referenced by main().
00201 { 00202 string fileprob="pb01.txt"; 00203 arcprob a1(fileprob); 00204 00205 string filearcs="pa04.txt"; 00206 00207 //cout << "arcprob constructed???" << endl; 00208 00209 assert(a1.ac!=0); 00210 00211 a1.ac->arcwriter("pa04.txt"); 00212 00213 cout << endl << endl; 00214 cout << "Look at the arc produced" << endl; 00215 00216 vector<arc> & vi(a1.ac->vi); 00217 for (uint i=0; i<vi.size(); ++i) 00218 vi[i].print(); 00219 }
| void test08 | ( | ) |
Definition at line 249 of file main.cpp.
References arc::constructPhi0TwoPoints(), degtorad, and arc::print().
Referenced by main().
00250 { 00251 pt2 p0(0.0,0.0); 00252 //pt2 p1(1.5,2.8); 00253 pt2 p1(1.5,0.8); 00254 double theta=315.0*degtorad; 00255 00256 arc a1; 00257 a1.constructPhi0TwoPoints(theta,p0,p1); 00258 a1.print(); 00259 00260 00261 }
| void writearcgeometry | ( | int | argc, | |
| char **& | argv | |||
| ) |
Definition at line 38 of file main.cpp.
References arc::arcreader(), gobj::global, commandline::mapvar(), print(), and gobjContainer::push().
Referenced by prog01().
00039 { 00040 commandline cmd(argc,argv); 00041 string filearcs = "pa03.txt"; 00042 cmd.mapvar(filearcs,"filearcs"); 00043 00044 if (filearcs.empty()) 00045 { 00046 cout << "error: no filearcs=<filename> command"; 00047 cout << " line argument" << endl; 00048 return; 00049 } 00050 00051 vector<arc> vi; 00052 arc::arcreader(vi,filearcs.c_str()); 00053 00054 for (uint i=0; i<vi.size(); ++i) 00055 { 00056 arcdraw *ad = new arcdraw(vi[i]); 00057 gobj::global->push(ad); 00058 } 00059 00060 print(vi); 00061 00062 }
1.5.8