Files Classes Functions Hierarchy
Sampled circle or ellipse. More...
#include <graphmisc.h>


Public Member Functions | |
| gobjMyCircle (doublec theta0, doublec theta1, doublec xaxislength, doublec yaxislength, uintc N_=360) | |
| General arcs can be created by changing the angle interval [theta0,theta1]. | |
| gobjMyCircle (doublec theta0, doublec theta1, doublec radius=1.0, uintc N_=360) | |
| Create an arc. | |
| gobjMyCircle (uintc N_=360) | |
| Create a circle. | |
| void | draw () |
| Dummy so that it can be placed on a gobj stack. | |
| ~gobjMyCircle () | |
| Cleanup. | |
Public Attributes | |
| uintc | N |
| The number of sampled points. | |
| float *const | ptx |
| The samples x values. | |
| float *const | pty |
| The samples y values. | |
Sampled circle or ellipse.
This can be used in drawing circles of different sizes by gobjMyCircleDraw .
Definition at line 645 of file graphmisc.h.
| gobjMyCircle::gobjMyCircle | ( | doublec | theta0, | |
| doublec | theta1, | |||
| doublec | xaxislength, | |||
| doublec | yaxislength, | |||
| uintc | N_ = 360 | |||
| ) |
General arcs can be created by changing the angle interval [theta0,theta1].
Ellipses can be made by changing the axis lengths.
Definition at line 268 of file graphmisc.cpp.
00275 : N(_N), ptx(new float[N]), 00276 pty(new float[N]) 00277 { 00278 //Just plot the curve 00279 assert(theta1>theta0); 00280 00281 float t=theta0; 00282 float dt=(theta1-theta0)/(N-1); 00283 00284 for (uint i=0; i<N; ++i) 00285 { 00286 ptx[i] = cos(t)*xaxislength; 00287 pty[i] = sin(t)*yaxislength; 00288 t += dt; 00289 } 00290 }
Create an arc.
Definition at line 293 of file graphmisc.cpp.
00299 : N(_N), ptx(new float[N]), 00300 pty(new float[N]) 00301 { 00302 assert(radius>0.0); 00303 00304 float t=theta0; 00305 float thetadiff = theta1-theta0; 00306 if (thetadiff<0.0) 00307 thetadiff += PI*2.0; 00308 float dt=thetadiff/(N-1); 00309 /* 00310 cout << SHOW(theta1-theta0) << " " << SHOW(thetadiff); 00311 cout << " " << SHOW(dt) << endl; 00312 */ 00313 00314 /* 00315 if (dt<0.0) 00316 dt += 2.0*PI; 00317 */ 00318 00319 for (uint i=0; i<N; ++i) 00320 { 00321 ptx[i] = cos(t)*radius; 00322 pty[i] = sin(t)*radius; 00323 t += dt; 00324 } 00325 00326 /* 00327 cout << SHOW(theta1-theta0) << " " << SHOW(dt) << endl; 00328 cout << SHOW(theta0) << " " << SHOW(theta1) << endl; 00329 cout << SHOW(cos(theta0)) << " " << SHOW(sin(theta0)) << endl; 00330 cout << SHOW(radius) << endl; 00331 cout << "start: (" << ptx[0] << "," << pty[0] << ")" << endl; 00332 cout << "end: (" << ptx[N-1] << "," << pty[N-1] << ")" << endl; 00333 */ 00334 00335 }
| gobjMyCircle::gobjMyCircle | ( | uintc | N_ = 360 |
) |
| gobjMyCircle::~gobjMyCircle | ( | ) |
| void gobjMyCircle::draw | ( | ) | [inline, virtual] |
Dummy so that it can be placed on a gobj stack.
Implements gobj.
Definition at line 683 of file graphmisc.h.
References GOBJDEBUGCODE.
00683 { GOBJDEBUGCODE }
The number of sampled points.
Definition at line 650 of file graphmisc.h.
Referenced by gobjMyCircleDraw::draw().
| float* const gobjMyCircle::ptx |
The samples x values.
Definition at line 653 of file graphmisc.h.
Referenced by gobjMyCircleDraw::draw(), and ~gobjMyCircle().
| float* const gobjMyCircle::pty |
The samples y values.
Definition at line 655 of file graphmisc.h.
Referenced by gobjMyCircleDraw::draw(), and ~gobjMyCircle().
1.6.1