Ali
06-26-2007, 08:29 AM
I am using following to draw circles
where originX,Y is is center....vectorX1,Y1 are points to be drawn
vectorY1=originY+radius;
vectorX1=originX;
glBegin(GL_LINE_STRIP);
for(angle=0.0f;angle le (2.0f*3.14159);angle+=0.01f)
{
vectorX=originX+(radius*(float)sin((double)angle)) ;
vectorY=originY+(radius*(float)cos((double)angle)) ;
glVertex2d(vectorX1,vectorY1);
vectorY1=vectorY;
vectorX1=vectorX;
}
glEnd()
now i want to improve my application by drawing diagrams that have both lines(straight edges) and curves. whenever user want to add a arc/circle the drawing should start from the end point of the last line drawn in this way arc can be made upward or downward...I have tried to modify the above code but there is a distortion...please remember that circles are being drawn ok but arcs are a problem as the code starts from a point away from the endpoint of the last drawn line
kindly help
where originX,Y is is center....vectorX1,Y1 are points to be drawn
vectorY1=originY+radius;
vectorX1=originX;
glBegin(GL_LINE_STRIP);
for(angle=0.0f;angle le (2.0f*3.14159);angle+=0.01f)
{
vectorX=originX+(radius*(float)sin((double)angle)) ;
vectorY=originY+(radius*(float)cos((double)angle)) ;
glVertex2d(vectorX1,vectorY1);
vectorY1=vectorY;
vectorX1=vectorX;
}
glEnd()
now i want to improve my application by drawing diagrams that have both lines(straight edges) and curves. whenever user want to add a arc/circle the drawing should start from the end point of the last line drawn in this way arc can be made upward or downward...I have tried to modify the above code but there is a distortion...please remember that circles are being drawn ok but arcs are a problem as the code starts from a point away from the endpoint of the last drawn line
kindly help