Files Classes Functions Hierarchy
#include <planeinttest.h>
Public Member Functions | |
| void | test01 (int &argc, char **argv) |
Public Attributes | |
| gobjContainer | xGraphics |
| Global graphics container. | |
Definition at line 9 of file planeinttest.h.
| void planeinttest::test01 | ( | int & | argc, | |
| char ** | argv | |||
| ) |
Mouse interaction.
Definition at line 33 of file planeinttest.cpp.
References pointsurface< T, G >::addsurface2D(), gobjpush, plane::intersects(), commandline::mapvar(), planeinttestdisplay01(), planeinttestkeyboard01(), gobjContainerPrePost::pre, gobjContainer::push(), planepointsurface::scaleSet(), gobjContainer::set(), SHOW, zpr::update(), point3< T >::x, xGraphics, point3< T >::y, and point3< T >::z.
00034 { 00035 commandline cmd(argc,argv); 00036 00037 string in; 00038 00039 cmd.mapvar(in,"in"); 00040 if ( in.empty() ) 00041 { 00042 cout << "error: in=filename expected" << endl; 00043 return; 00044 } 00045 00046 ifstream filein(in.c_str()); 00047 assert(filein.good()==true); 00048 if (filein.good()==false) 00049 return; 00050 00051 point3<double> nml; 00052 double d; 00053 00054 filein >> nml.x; 00055 filein >> nml.y; 00056 filein >> nml.z; 00057 filein >> d; 00058 00059 plane P1(nml,d); 00060 00061 filein >> nml.x; 00062 filein >> nml.y; 00063 filein >> nml.z; 00064 filein >> d; 00065 00066 plane P2(nml,d); 00067 00068 //cout << SHOW(nml) << endl; 00069 //cout << SHOW(d) << endl; 00070 00071 point3<double> A; 00072 point3<double> B; 00073 00074 bool res = P1.intersects(A,B,P2); 00075 cout << SHOW(res) << endl; 00076 00077 00078 glutInit(&argc,argv); 00079 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00080 glutInitWindowSize(800,600); 00081 glutCreateWindow(""); 00082 glutDisplayFunc(planeinttestdisplay01); 00083 glutKeyboardFunc(planeinttestkeyboard01); 00084 00085 OpenGLinitialisation(); 00086 00087 glEnable(GL_DEPTH_TEST); 00088 glEnable(GL_CULL_FACE); 00089 glEnable(GL_NORMALIZE); 00090 00092 zpr zz; 00093 00094 xGraphics.set(); 00095 00096 planepointsurface f1(P1); 00097 pointsurface<> ps1(4000); 00098 ps1.pre.push(new gobjglColor3ub(184,134,11) ); 00099 ps1.addsurface2D(f1); 00100 gobjpush(&ps1); 00101 00102 planepointsurface f2(P2); 00103 pointsurface<> ps2(4000); 00104 00105 f2.scaleSet(100.0); 00106 00107 ps2.pre.push(new gobjglColor3ub(192,192,192) ); 00108 ps2.addsurface2D(f2); 00109 gobjpush(&ps2); 00110 00111 gobjpush(new gobjglDisable(GL_LIGHTING)); 00112 00113 gobjpush(new gobjglColor3ub(255,0,0) ); 00114 gobjpush(new gobjglBegin(GL_LINES)); 00115 00116 gobjpush(new gobjglVertex3d(A+B*(-10.0))); 00117 gobjpush(new gobjglVertex3d(A+B*10.0)); 00118 00119 gobjpush(new gobjglEnd() ); 00120 00121 zz.update(); 00122 glutMainLoop(); 00123 }
1.5.8