//somewhere in the beginning
float angle = 0.0;
case GLUT_KEY_RIGHT: //when this button is pressed
int i, xo = 20; // i is for loop and xo is x coordinate of the circle center
for (i=0; i<=object.vertices_qty; i++) //go through all the vertices
{
if(object.vertex[i].x > xo) //if the x coordinate is bigger than xo - choose the part to rotate
{
if(object.vertex[i].r == 0) //calculate the circle radius if it hasn't been already done
object.vertex[i].r = object.vertex[i].x-xo;
angle += 0.001; //increment the angle
//now I want to calculate new vertex coordinates (after rotation)
object.vertex[i].y = object.vertex[i].w + object.vertex[i].r*cos(angle); //object.vertex[i].w is original y coordinate (before rotation) which is also coordinate of the circle center
object.vertex[i].x = xo + object.vertex[i].r*sin(angle);
}
}
break;