# X,Y Characteristics of a circle

• 09-08-2004
MicroFiend
X,Y Characteristics of a circle
hey, ok first off heres my prob, i want to plot a circle using a setpixel algorithm (it is important that i use setpixel) but at present all i can get it doing is stuff like a diamond or a hexagon, ive got a few ideas of how it might work like by seperating it into 4 quadrants and use a decayed x,y value in each quaderant that is incrementing to the inverse of each other but that only gave me my diamond lol, erm so has any1 got any info maybee a web link or if u can post any code or any hints of how it might work
• 09-08-2004
sand_man
This might be a stupid and obvious question to ask, but have you tried writing an algo using
or whatever the formula is (its been a while since high school :) )
• 09-08-2004
MicroFiend
thanx for ur reply, hmm im interested im not sure what u meen, pr2 is the area of a circle, how could i apply this to plot each pixel into a circle.. i keep trying to visualize the movements of a circle and picturing the x,y values at each point but no good, maybee i should draw a circle in paint and note down the x,y data into a table and analyse it... heh
• 09-08-2004
prog-bman
Hmmmm im not good with math but maybe do something with the circumference of the circle and then the distance of the circle then some sort of function to traverse your starting point to 360 degrees (im sure this is wrong but hey made me think a little)
• 09-08-2004
MicroFiend
omg ive actualy found a use for my old maths books, "reading" i think this may hold the answer its saying that each point in a circle will share the idea x2 + y2 = 25
• 09-08-2004
prog-bman
I'd like to know how you did it if you find out keep me posted :)
• 09-08-2004
MicroFiend
hmm ok this is what i got so far, ive concluded that if radius is say 5 then , at any given point the sum of (x*x) + (y*y) must equal r*r (25) so the way i see it, y must be worked out by this equation:
x=x+1
y=25-(x*x)
then i have to plot the xy characteristics of the................... aha wait i think i figured it
*thinking as i post* i have to then root the y value before i can try and plot it right?
il post back if it works
• 09-08-2004
MicroFiend
it worked like a charm hehe, thanx for ur help