1. Integer based circle equation

Hi I am wondering if it is possible to get an integer based function for a circle. I tried using the y = Square Root(r^2 - x^2) function and rounding off the y values but that just gives me a broken circle. The reason I need an integer based result is that im plotting this into a matrix array and not a Cartesian graph so I just need a rough representation of a circle. There are programming algorithms to do this like Bresenham's Circle Algorithm but just wondering if it's possible using the original circle equation.

Thanks,
satusjin.

2. Re: Integer based circle equation

Originally Posted by satsujin
Hi I am wondering if it is possible to get an integer based function for a circle. I tried using the y = Square Root(r^2 - x^2) function and rounding off the y values but that just gives me a broken circle. The reason I need an integer based result is that im plotting this into a matrix array and not a Cartesian graph so I just need a rough representation of a circle. There are programming algorithms to do this like Bresenham's Circle Algorithm but just wondering if it's possible using the original circle equation.

Thanks,
satusjin.
Have a look here: Pythagorean triple - Wikipedia, the free encyclopedia

3. Re: Integer based circle equation

Sorry, my bad. I was only looking at one quadrant of the circle. Once I added in all the quadrants the broken areas of the first quadrant were filled in. However, there is significant overlap in the points. Any formula that doesn't regenerate the same points again? I am current getting y using the circle equation, incrementing x by 1 until i get the radius and based on the x,y values i get generating quadrants by combining all the possible values of +x,+y,-x,-y. So, for a radius r, that's r*8 x,y pairs.

4. Re: Integer based circle equation

Originally Posted by earboth
Thanks, earboth. I'll give that a deeper looksee, but I suspect it's above my primitive math level. I also suspect multiple square roots to solve a triple for x and y values which is something I'm trying to avoid.