why is the circle not completed !!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jessy
    New Member
    • Oct 2006
    • 106

    why is the circle not completed !!

    i'm writing a c code to implement a circle using Midpoint algorithm ..but when i run the program i just see half the circle ( only one quadrant ) where is the rest ?????????

    void MidpointCircle ( int radius, int color )
    {
    int x, y;
    float d;


    x = 0;
    y = radius;
    d = 5.0 / 4 - radius;
    CirclePoints ( x, y, color );

    while ( y > x ) {
    if ( d < 0 ) {
    d += x * 2.0 + 3;
    x ++;
    }
    else {
    d += (x - y) * 2.0 + 5;
    x ++;
    y --;
    }
    CirclePoints ( x, y, color );
    }
    }


    void CirclePoints (float x, float y, int color)
    {
    putpixel ( x, y, color );
    putpixel ( y, x, color );
    putpixel ( y, -x, color );
    putpixel ( x, -y, color );
    putpixel ( -x, -y, color );
    putpixel ( -y, -x, color );
    putpixel ( -y, x, color );
    putpixel ( -x, y, color );
    }
  • RADAR
    New Member
    • Oct 2006
    • 21

    #2
    I hope you have declared the functions you have written the following
    CirclePoints ( x, y, color );
    putpixel ( x, y, color );
    don't have any declarations.

    Comment

    • jessy
      New Member
      • Oct 2006
      • 106

      #3
      Of cOurse I have ......and of course that's not the problem.......

      Comment

      Working...