void D3DGraphics::DrawCircle(int x0,int y0,int R)
{
float RR=R*R;
for(int x=-R;x<=R;x++)
{
int y=sqrt(RR-x*x);
PutPixel(x0+x,y0+y,225,225,225);
PutPixel(x0+x,y0-y,225,225,225);
}
for(int y=-R;y<=R;y++)
{
int x=sqrt(RR-y*y);
PutPixel(x0+x,y0+y,225,225,225);
PutPixel(x0-x,y0+y,225,225,225);
}
}
i think the code looks better like this but i was wondering if this takes more ram than Chili's version
Lesson 11 my idea for DrawCircle function
Re: Lesson 11 my idea for DrawCircle function
It won't take more ram bro, it will just be slower. My implementation does one Pythagorean for every 8 pixels, yours does one for every 2.
There are implementations that are faster than mine but even more complicated to understand. Google midpoint circle algorithm if you're interested.
There are implementations that are faster than mine but even more complicated to understand. Google midpoint circle algorithm if you're interested.
Chili
Re: Lesson 11 my idea for DrawCircle function
At least i tried thanks
Re: Lesson 11 my idea for DrawCircle function
Yup bro, that is the correct attitude.
Never stop tryin' new shit.
Never stop tryin' new shit.
Chili