Files Classes Functions Hierarchy
#include <plotpolartest.h>
Public Member Functions | |
| int | test01 (int argc, char **&argv) |
| Display a polar plot heart with axes. | |
Static Public Member Functions | |
| static void | keyboard01 (unsigned char key, int x, int y) |
| ESC to quit. | |
| static void | display01 () |
| Display the plot. | |
Definition at line 11 of file plotpolartest.h.
| void plotpolartest::display01 | ( | ) | [static] |
Display the plot.
Definition at line 24 of file plotpolartest.cpp.
References gobjContainer::draw(), glerrordisplay(), and gobj::global.
Referenced by test01().
00025 { 00026 myglPushMatrixMode temp; 00027 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00028 00029 assert(gobj::global!=0); 00030 gobj::global->draw(); 00031 00032 glerrordisplay(); 00033 00034 glutSwapBuffers(); 00035 }
| void plotpolartest::keyboard01 | ( | unsigned char | key, | |
| int | x, | |||
| int | y | |||
| ) | [static] |
| int plotpolartest::test01 | ( | int | argc, | |
| char **& | argv | |||
| ) |
Display a polar plot heart with axes.
Definition at line 38 of file plotpolartest.cpp.
References protractor::addAngleRuler(), protractor::addAxes(), protractor::addCircles(), protractor::addCirclesText(), plotpolar::addcrosses(), plotpolar::adddatapointsinPolarRadians(), protractor::addRadiusRuler(), display01(), keyboard01(), gobjContainer::push(), gobjContainer::set(), and zpr::update().
00039 { 00040 glutInit(&argc,argv); 00041 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00042 uintc wx=800; 00043 uintc wy=800; 00044 00045 glutInitWindowSize(wx,wy); 00046 00047 glutCreateWindow(""); 00048 00049 glutDisplayFunc(display01); 00050 glutKeyboardFunc(keyboard01); 00051 00052 OpenGLinitialisation(); 00053 00054 glEnable(GL_DEPTH_TEST); 00055 glEnable(GL_CULL_FACE); 00056 00057 xGraphics.set(); 00058 00059 00060 // Create the heart plot of points. 00061 00062 vector< point2<double> > v; 00063 00064 uintc n=50; 00065 // The degrees are converted to radians. 00066 double dt = PI * 2.0 / n; 00067 00068 for (uint i=0; i<n; ++i) 00069 { 00070 v.push_back( point2<double>(1.0+cos(dt*i),dt*i) ); 00071 //v.push_back( point2<double>(1.0,dt*i) ); 00072 } 00073 00074 plotpolar * plt = new plotpolar(); 00075 plt->adddatapointsinPolarRadians(v); 00076 //plt->addpoints(255,0,0); 00077 plt->addcrosses(0,255,0,0.05); 00078 xGraphics.push(plt); 00079 00080 protractor * prot = new protractor(2.5); 00081 prot->addAxes(8); 00082 prot->addCircles(5); 00083 00084 stringc nms[] = 00085 { 00086 "0", "45", "90", "135", "180", 00087 "225", "270", "315" 00088 }; 00089 vector<string> ang(nms,nms+8); 00090 00091 prot->addCirclesText(ang); 00092 00093 prot->addRadiusRuler(0.15, 0.1, 0.05); 00094 00095 prot->addAngleRuler(0.15, 0.1, 0.05); 00096 00097 00098 xGraphics.push(prot); 00099 00100 zpr zz; 00101 00102 zz.update(); 00103 glutMainLoop(); 00104 00105 00106 00107 return 0; 00108 }
1.5.8