Files Classes Functions Hierarchy
#include <helix.h>
Public Member Functions | |
| helix () | |
| Do nothing constructor. | |
| helix (doublec nturns, uintc Nspikes_) | |
| Partially create a helix, assign length and radius before drawing. | |
| helix (doublec nturns, uintc Nspikes_, doublec length_, doublec radius_) | |
| Create a helix. | |
| void | construct (doublec nturns, uintc Nspikes_) |
| Partially create a helix, assign length and radius before drawing. | |
| void | draw () |
| Draw the helix without color. | |
Public Attributes | |
| double | length |
| The spikes length. | |
| double | radius |
| The number of turns the helix has. | |
The length and radius can be changed before each draw.
Definition at line 22 of file helix.h.
| helix::helix | ( | ) |
Do nothing constructor.
Definition at line 5 of file helix.cpp.
References construct().
00006 { 00007 construct(0.0,0); 00008 }
Partially create a helix, assign length and radius before drawing.
Definition at line 33 of file helix.cpp.
Referenced by helix().
00037 { 00038 Nspikes = Nspikes_; 00039 00040 double dtheta = 2.0*3.14159265*nturns/(Nspikes-1.0); 00041 00042 angles.resize(Nspikes); 00043 double theta; 00044 for (uint i=0; i<Nspikes; ++i) 00045 { 00046 theta = i*dtheta; 00047 angles[i].x = cos(theta); 00048 angles[i].y = sin(theta); 00049 } 00050 }
| void helix::draw | ( | ) | [virtual] |
Draw the helix without color.
Implements gobj.
Definition at line 53 of file helix.cpp.
References length, and radius.
00054 { 00055 if (length==0.0) 00056 return; 00057 00058 assert(length>0.0); 00059 00060 double dx = length/(Nspikes-1.0); 00061 double x; 00062 glBegin(GL_LINES); 00063 for (uint i=0; i<Nspikes; ++i) 00064 { 00065 x = dx*i; 00066 00067 glVertex3d(x,radius*angles[i].x,radius*angles[i].y); 00068 glVertex3d(x,0.0,0.0); 00069 } 00070 glEnd(); 00071 }
| double helix::length |
| double helix::radius |
1.5.8