1. ## Circles and Computers

Hey all,

While this is connected with C, I put it here, since it's technically a computer quiestion. So on we go.

When you tell the computer to draw a circle with a diameter x on the screen, it won't draw a perfect circle. Why? Well, let's skip the "Pi is irrational part" for a second. The screen is made of pixels. Pixels are squares. So, ultimately, the shape we see is lots of tiny squares put together so as to form something resembling a circle. But it's not a circle. It's squares. Now here's what I need; how does a computer know, based on the diameter of the circle that we want it to draw, how many squares to draw, and what shape to make? I'm writing a program where I need to be able to say "Okay, the diameter is two (in pixels), so that means that we're going to have 5 squares, and it will look like a plus sign.". So I took a squared paper, and tried to draw the shapes up myself, and to be honest, I'm pretty sure I got 'circles' with diameters three and four (in squares) right, but anything higher than that, and I don't have a clue how it's supposed to look.

Could anybody here tell me, given a radius x, how many pixels, or "squares" the computer needs to draw to form the shape we perceive to be a circle? And how that shape looks? Or at least tell me how to draw up the shapes myself, I can calculate the formula from there.

Cheers,

Gabe

EDIT: I've been doing some drawings, based on intuition, and here's what I got:

Am I on the right track?

2. There are algorithms like the midpoint-circle algorithm which you can use to draw circles on screen. A quick google search for Midpoint-circle Algorithm will give you the necessary links explaining the algorithm.

3. generalyl based on the width of the pixel it determines the radial velocity of teh drw function so that it doesnt leave gaps. It ten itteratively calculates the coordinates based on an angle until it draws all 360 degrees. There are also optimized non-trig methods for drawing a cirlce.

4. Thanks a million