Files Classes Functions Hierarchy
#include <meshpatchtest.h>
Public Member Functions | |
| void | test01 () |
| Evaluate a point on a patch by entering u,v. | |
| void | test02 (int argc, char **argv) |
| Display a point grid with bilinear patches as points. | |
| void | test03 (int argc, char **argv) |
| Uniform subdivision. | |
| void | test04 (int argc, char **argv) |
| Display the point grid with triangles. | |
Definition at line 8 of file meshpatchtest.h.
| void meshpatchtest::test01 | ( | ) |
Evaluate a point on a patch by entering u,v.
Definition at line 54 of file meshpatchtest.cpp.
References meshpatch::eval(), and SHOW.
00055 { 00056 meshpatch m(1,1); 00057 00058 meshtestpatch01 pij; 00059 00060 cout << "Enter u v: "; 00061 double u,v; 00062 cin >> u >> v; 00063 00064 pt3 p; 00065 m.eval(p,u,v,pij); 00066 00067 cout << SHOW(p) << endl; 00068 00069 }
| void meshpatchtest::test02 | ( | int | argc, | |
| char ** | argv | |||
| ) |
Display a point grid with bilinear patches as points.
Definition at line 97 of file meshpatchtest.cpp.
References gobjpush, pointgrid3D::M, meshpatchtestdisplay01(), meshpatchtestkeyboard01(), pointgrid3D::N, pointgrid3D::pt, gobjContainer::set(), zpr::update(), pointgrid3Dbilineardraw::update(), and pointgrid3Ddraw::update().
00098 { 00099 glutInit(&argc,argv); 00100 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00101 glutInitWindowSize(800,600); 00102 glutCreateWindow(""); 00103 glutDisplayFunc(meshpatchtestdisplay01); 00104 glutKeyboardFunc(meshpatchtestkeyboard01); 00105 00106 OpenGLinitialisation(); 00107 00108 glEnable(GL_DEPTH_TEST); 00109 glEnable(GL_CULL_FACE); 00110 glEnable(GL_NORMALIZE); 00111 00112 zpr zz; 00113 00114 xGraphics.set(); 00115 00116 //pointgrid3D g(10,10,-1.0,3.0,-1.0,3.0); 00117 pointgrid3D g(5,4,-1.0,3.0,-1.0,3.0,true); 00118 00119 pointgrid3Ddraw gd(g); 00120 00121 gobjpush(&gd); 00122 00123 tempsin2 f2; 00124 00125 func2Dovervec3D< point3<double> >(g.pt,g.M*g.N).evalY(f2); 00126 00127 gd.update(); 00128 00129 //cout << printvecfunc(g.pt,g.M*g.N,"\n") << endl; 00130 00131 pointgrid3Dbilineardraw gbd(g); 00132 gobjpush(&gbd); 00133 gbd.update(); 00134 00135 00136 //gobj::globaldisplaylist(); 00137 00138 zz.update(); 00139 00140 glutMainLoop(); 00141 }
| void meshpatchtest::test03 | ( | int | argc, | |
| char ** | argv | |||
| ) |
Uniform subdivision.
Definition at line 144 of file meshpatchtest.cpp.
References triangleuniformsubdivision< T >::divide(), gobjpush, meshpatchtestdisplay01(), meshpatchtestkeyboard01(), pts, gobjContainer::set(), and zpr::update().
00145 { 00146 glutInit(&argc,argv); 00147 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00148 glutInitWindowSize(800,600); 00149 glutCreateWindow(""); 00150 glutDisplayFunc(meshpatchtestdisplay01); 00151 glutKeyboardFunc(meshpatchtestkeyboard01); 00152 00153 OpenGLinitialisation(); 00154 00155 glEnable(GL_DEPTH_TEST); 00156 glEnable(GL_CULL_FACE); 00157 glEnable(GL_NORMALIZE); 00158 00159 zpr zz; 00160 00161 00162 xGraphics.set(); 00163 00164 vector< point3<double> > pts; 00165 vector< point3<uint> > vi; 00166 00167 pts.push_back( point3<double>(0.0,0.0,0.0)); 00168 pts.push_back( point3<double>(1.0,0.0,0.0)); 00169 pts.push_back( point3<double>(0.5,1.0,0.0)); 00170 00171 point3<uint> tri0(0,1,2); 00172 //vi.push_back(tri0); 00173 00174 /* 00175 triangleuniformsubdivision< point3<double> > tusd(vi,pts); 00176 tusd.divide(tri0); 00177 */ 00178 00179 vector< point3<uint> > vi2; 00180 triangleuniformsubdivision< point3<double> > tusd2(vi2,pts); 00181 00182 // tusd2.divide(vi); 00183 00184 tusd2.divide(tri0,3); 00185 00186 00187 /* 00188 vectorprint::space="\n"; 00189 cout << "vi" << endl; 00190 cout << vi << endl; 00191 cout << SHOW(vi.size()) << endl; 00192 cout << "pts" << endl; 00193 cout << pts << endl; 00194 cout << SHOW(pts.size()) << endl; 00195 */ 00196 00197 triangles3Tdisplaymulticolored<GLfloat,double> * td = 00198 new triangles3Tdisplaymulticolored<GLfloat,double>(vi2.size(), & vi2[0], & pts[0]); 00199 gobjpush(td); 00200 00201 zz.update(); 00202 glutMainLoop(); 00203 }
| void meshpatchtest::test04 | ( | int | argc, | |
| char ** | argv | |||
| ) |
Display the point grid with triangles.
Definition at line 206 of file meshpatchtest.cpp.
References pointgrid3D::createIndexedTriangles(), gobjpush, pointgrid3D::M, meshpatchtestdisplay01(), meshpatchtestkeyboard01(), pointgrid3D::N, pointgrid3D::pt, pts, gobjContainer::set(), zpr::update(), and pointgrid3Ddraw::update().
00207 { 00208 glutInit(&argc,argv); 00209 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00210 glutInitWindowSize(800,600); 00211 glutCreateWindow(""); 00212 glutDisplayFunc(meshpatchtestdisplay01); 00213 glutKeyboardFunc(meshpatchtestkeyboard01); 00214 00215 OpenGLinitialisation(); 00216 00217 glEnable(GL_DEPTH_TEST); 00218 glEnable(GL_CULL_FACE); 00219 glEnable(GL_NORMALIZE); 00220 00221 zpr zz; 00222 00223 xGraphics.set(); 00224 00225 //pointgrid3D g(10,10,-1.0,3.0,-1.0,3.0); 00226 pointgrid3D g(5,4,-1.0,3.0,-1.0,3.0,true); 00227 00228 pointgrid3Ddraw gd(g); 00229 00230 gobjpush(&gd); 00231 00232 tempsin2 f2; 00233 00234 func2Dovervec3D< point3<double> >(g.pt,g.M*g.N).evalY(f2); 00235 00236 gd.update(); 00237 00238 //cout << printvecfunc(g.pt,g.M*g.N,"\n") << endl; 00239 00240 //pointgrid3Dbilineardraw gbd(g); 00241 //gobjpush(&gbd); 00242 //gbd.update(); 00243 00244 00245 vector< point3<double> > pts; 00246 vector< point3<uint> > vi; 00247 g.createIndexedTriangles(pts,vi); 00248 00249 triangles3Tdisplaymulticolored<GLfloat,double> * td = 00250 new triangles3Tdisplaymulticolored<GLfloat,double>(vi.size(), & vi[0], & pts[0]); 00251 gobjpush(td); 00252 00253 00254 zz.update(); 00255 glutMainLoop(); 00256 }
1.5.8