void FILLED_Circle_MIDPOINT(float xc, float yc, int R)
{
const int Rsqr = R*R;
for(int y = 0; y < R ; ++y )
{
int width = sqrt( Rsqr - y*y );// find width of circle at this y
for(int x = 0; x < width; ++x) //draw a horizontal line of that width
{
SetPixel( g_hdc, xc+x, yc+y, RGB(g_color.red, g_color.green, g_color.blue) );
SetPixel( g_hdc, xc+x, yc-y, RGB(g_color.red, g_color.green, g_color.blue) );
SetPixel( g_hdc, xc-x, yc+y, RGB(g_color.red, g_color.green, g_color.blue) );
SetPixel( g_hdc, xc-x, yc-y, RGB(g_color.red, g_color.green, g_color.blue) );
}
}
}
[edited by - SinisterIllusion on June 16, 2003 6:21:54 PM]
Filled Ellipse Algorithm
Can someone explain how I can scan convert a filled ellipse? I have the following code that was posted here previously for a filled circle that. I was thinking I could build off of it. The equation for width is what's giving me the trouble.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement