Assignment 05.
- Use the mid-point circle technique to derive the necessary equations to scan convert the following circular sector (i.e., points from 270o to 315o).
- Implement your method and use the circle's symmetric property to draw complete circles.
- The file is available here (ScanConvertCirclemidpoint.cpp)
- Play with it. You will understand..
this code also correct!!
void MidpointCircle(GLint x1, GLint y1, GLint x2, GLint y2){
/********************************************************************
This function draws a Circle using the Midpoint Circle algorithm for 270 - 315
*********************************************************************/
float r1 = (x2-x1)(x2-x1) + (y2-y1)(y2-y1);
float r = sqrt(r1);
int x=0,y=-r,p=1-r;
while(x<=-y)
{
plot(x1+x,y1+y);
if(p<0)
{
p=p+2*x+3;
}
else
{
p=p+2*(x+y)+5;
y++;
}
x++;
}
}