// morphing // pentagon-square-19gram // The shape changes itself. // T. Kosaka CS TNCT 2001 #include #include #include #include "drawShape2D.h" #ifndef M_PI #define M_PI 3.141592653589793 #endif void userdraw(void); void display(void) { glClear( GL_COLOR_BUFFER_BIT); userdraw(); glutSwapBuffers(); } ////////////////////////////////////////////////////////////////// void drawcharX(float x,float y) //文字 x の表示 { drawLine(x,y,x+10,y+12);drawLine(x,y+12,x+10,y); } void drawcharY(float x,float y) //文字 y の表示 { drawLine(x+5,y,x+5,y+7);drawLine(x,y+12,x+5,y+7);drawLine(x+10,y+12,x+5,y+7); } void drawAxes(void) // xy軸の表示 { drawLine(-310,0,310,0);drawLine(310,0,300,5);drawLine(310,0,300,-5); drawcharX(300,-20); drawLine(0,-230,0,230);drawLine(0,230,5,220);drawLine(0,230,-5,220); drawcharY(-20,220); } ////////////////////////////////////////////////////////////////// point2D_t interpolate(point2D_t a, point2D_t b, float r) { // 0.0<=r<=1.0 AC:CB=r:(1-r) if (r<0.0) r=0.0; if (1.0