|
x |
|\ |
| \r |
j| \ |
| \|
----------\---------
i |
|
|
|
|
// make use of pythoragus theorm
DrawCircle( Point origin, size_t radius )
{
for ( int x = (origin.x - radius) ; x <= (origin.x) ; x++ )
for ( int y = (origin.y - radius) ; y <= (origin.y) ; y++ )
if ( pow(i,2) + pow (j,2) == pow{r,2) )
{
// Set the pixels symmetrically.
SetPixel(i,j);
SetPixel(origin.x + i, j);
SetPixel(i,origin.y + j);
SetPixel(origin.x + i, origin.y + j);
}
}
Drawing a circle without floating point ops.
Write a routine to draw a circle given a center coordiante (x,y) and a radius (r) without making use of any floating point computations
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment