I am trying to understand how I can draw a set of points (/set the pixels) that form a circle without using the library functions.

Now, getting the (x,y) co-ordinates of the points given the radius is straightforward.

    for (x=-r; x <r; x=x+0.1) {
         y = sqrt(r*r - x*x);
         draw(x,y, 0, 0);
     }

But once I have the points, how do you actually draw the circle is what is confusing to me. I can use the graphic library but I want to understand how you can do it without using the graphics library

    void draw(float x, float y, float center_x, float center_y) {
          //logic to set pixel given x, y and circle's center_x and center_y
          // basically print x and y on the screen say print as a dot .
          // u 'd need some sort of a 2d char array but how do you translate x and y
          // to pixel positions
    }

Could someone share any links/references or explain how this works?

c
Edit
Report