Files Classes Functions Hierarchy
#include <protractor.h>
Public Member Functions | |
| protractor (doublec _radius) | |
| The protractors great circle is defined by the radius. | |
| void | addCircles (uintc n) |
| void | addAxes (uintc n) |
| void | addCirclesText (vector< string > const &v) |
| void | addRadiusRuler (doublec ticklenmajor, doublec ticklenmiddle, doublec ticklenminor) |
| void | addAngleRuler (doublec ticklenmajor, doublec ticklenmiddle, doublec ticklenminor) |
Static Public Member Functions | |
| static void | converttocartesian (point2< double > &p, point2< double > const &p2) |
| Convert a vector of 2D points from polar to cartesian. | |
Public Attributes | |
| double | radius |
| The radius controls the protractors size. | |
This draws the protractor allowing the client to configure the size, rulers and labels.
Definition at line 18 of file protractor.h.
| protractor::protractor | ( | doublec | _radius | ) |
The protractors great circle is defined by the radius.
Definition at line 69 of file protractor.cpp.
00070 : gobjContainer(true), radius(_radius) 00071 { 00072 }
| void protractor::addAngleRuler | ( | doublec | ticklenmajor, | |
| doublec | ticklenmiddle, | |||
| doublec | ticklenminor | |||
| ) |
Definition at line 15 of file protractor.cpp.
References ruler::addAngleRuler(), and r.
Referenced by plotpolartest::test01().
00020 { 00021 ruler * r = new ruler(); 00022 r->addAngleRuler 00023 ( 00024 radius, 00025 0.0, 00026 360.0, 00027 ticklenmajor, 00028 ticklenmiddle, 00029 ticklenminor 00030 ); 00031 00032 push(r); 00033 }
| void protractor::addAxes | ( | uintc | n | ) |
Definition at line 139 of file protractor.cpp.
References converttocartesian(), gobjContainer::gobjContainer(), gobjContainer::push(), and radius.
Referenced by plotpolartest::test01().
00140 { 00141 double dt = PI * 2.0 / n; 00142 00143 gobjContainer * c = new gobjContainer(); 00144 00145 point2<double> x0; 00146 00147 c->push( new gobjglPushAttrib(GL_CURRENT_BIT) ); 00148 c->push( new gobjglPushAttrib(GL_LIGHTING_BIT) ); 00149 c->push( new gobjglDisable(GL_LIGHTING) ); 00150 00151 c->push( new gobjglColor3ub(155,0,0) ); 00152 00153 c->push( new gobjglBegin(GL_LINES) ); 00154 for (uint i=0; i<n; ++i) 00155 { 00156 point2<double> x1(radius,dt*i); 00157 converttocartesian(x0,x1); 00158 c->push( new gobjglVertex2f(x0) ); 00159 c->push( new gobjglVertex2f(0.0,0.0) ); 00160 } 00161 c->push(new gobjglEnd()); 00162 00163 c->push( new gobjglPopAttrib() ); 00164 c->push( new gobjglPopAttrib() ); 00165 00166 push(c); 00167 }
| void protractor::addCircles | ( | uintc | n | ) |
Definition at line 109 of file protractor.cpp.
References gobjContainer::gobjContainer(), gobjContainer::push(), and radius.
Referenced by plotpolartest::test01().
00110 { 00111 gobjContainer * c = new gobjContainer(); 00112 00113 gobjMyCircle * cir = new gobjMyCircle(); 00114 c->push(cir); 00115 00116 c->push( new gobjglPushAttrib(GL_CURRENT_BIT) ); 00117 c->push( new gobjglPushAttrib(GL_LIGHTING_BIT) ); 00118 c->push( new gobjglDisable(GL_LIGHTING) ); 00119 00120 c->push( new gobjglColor3ub(192,192,192) ); 00121 00122 00123 double dr = radius / n; 00124 00125 gobjMyCircleDraw * cird; 00126 00127 for (uint i=0; i<n; ++i) 00128 { 00129 cird = new gobjMyCircleDraw( dr * (i+1), point3<float>(), *cir ); 00130 c->push(cird); 00131 } 00132 00133 c->push( new gobjglPopAttrib() ); 00134 c->push( new gobjglPopAttrib() ); 00135 00136 push(c); 00137 }
| void protractor::addCirclesText | ( | vector< string > const & | v | ) |
Definition at line 75 of file protractor.cpp.
References gobjContainer::push(), point2< T >::x, and point2< T >::y.
Referenced by plotpolartest::test01().
00078 { 00079 uintc n = v.size(); 00080 00081 gobjContainer * c = new gobjContainer(); 00082 00083 double dt = PI * 2.0 / n; 00084 00085 point2<double> x0; 00086 00087 c->push( new gobjglPushAttrib(GL_CURRENT_BIT) ); 00088 c->push( new gobjglPushAttrib(GL_LIGHTING_BIT) ); 00089 c->push( new gobjglDisable(GL_LIGHTING) ); 00090 00091 c->push( new gobjglColor3ub(0,192,130) ); 00092 00093 for (uint i=0; i<n; ++i) 00094 { 00095 point2<double> x1(radius,dt*i); 00096 converttocartesian(x0,x1); 00097 00098 c->push( new gobjMyBitmapCharacter(v[i], point3<float>(x0.x,x0.y,0.0)) ); 00099 } 00100 00101 c->push( new gobjglPopAttrib() ); 00102 c->push( new gobjglPopAttrib() ); 00103 00104 push(c); 00105 }
| void protractor::addRadiusRuler | ( | doublec | ticklenmajor, | |
| doublec | ticklenmiddle, | |||
| doublec | ticklenminor | |||
| ) |
Definition at line 37 of file protractor.cpp.
References ruler::addStraightRuler(), and r.
Referenced by plotpolartest::test01().
00042 { 00043 ruler * r = new ruler(); 00044 00045 r->addStraightRuler 00046 ( 00047 radius, 00048 point2<double>(0.0,0.0), 00049 point2<double>(radius,0.0), 00050 ticklenmajor, 00051 ticklenmiddle, 00052 ticklenminor 00053 ); 00054 00055 push(r); 00056 }
Convert a vector of 2D points from polar to cartesian.
Definition at line 60 of file protractor.cpp.
References point2< T >::x, and point2< T >::y.
Referenced by addAxes().
| double protractor::radius |
The radius controls the protractors size.
Definition at line 23 of file protractor.h.
Referenced by addAxes(), and addCircles().
1.5.8