#ifndef __stair #define __start #include class Stair{ public: Stair(double,double,int,int,int,int,double); void draw(void); double getAngle(void); void setAngle(double); private: int startx; // where we begin int starty; // where we begin, we rotate around this axis int startz; // where we begin int numsteps; double radius; double height; double angle; double rot; }; Stair::Stair(double radius, double height, int startx, int starty,int startz, int numsteps,double angle){ this->radius = radius; this->height = height; this->startx = startx; this->starty = starty; this->startz = startz; this->numsteps= numsteps; this->angle = angle; this->rot = 0; } /////////////////////// // Stair::draw void Stair::draw(void){ double ypos = starty; double ang = 0; glRotatef(rot,0,1,0); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glBegin(GL_QUAD_STRIP); // draw the first line glVertex3f(startx,ypos,startz); glVertex3f(radius*sin(ang*M_PI/180.0),ypos,radius*cos(ang*M_PI/180.0)); for(int i=0;i360.0) ang-=360.0; glVertex3f(startx,ypos,startz); glVertex3f(radius*sin(ang*M_PI/180.0),ypos,radius*cos(ang*M_PI/180.0)); } glEnd(); } ///////////////////////////// // Stair::getAngle double Stair::getAngle(void){ return rot; } ///////////////////////////////// // Stair::setAngle void Stair::setAngle(double rot){ this->rot=rot; } #endif