I'm super new to c++ and all this math business... failed miserably throughout highschool.
I'm having an odd problem with the circle plotting. I mimicked all your instructions and kept up with all your build outputs(including the incomplete circle parts that you systematically debugged). The part that everything broke for me is right after you added the second putpixel line. I swear I have everything in the same order, but apparently something is missing. Instead of a circle, I get 2 horizontal lines xD
Are there any source files I can look at to find out what I'm doing wrong? I've gone over and over and I just don't know what's wrong. Thanks
Lesson 11 Source Files?
Re: Lesson 11 Source Files?
For reference, here's what I wrote:
Code: Select all
void D3DGraphics::DrawCircle(int cx, int cy, int rad, int r, int g, int b){
float radSqr = rad * rad;
for( int x = -rad; x <= rad; x++)
{
int y = sqrt(radSqr - x*x);
PutPixel(cx + x,cy + cy,r,g,b);
PutPixel(cx + x,cy - cy,r,g,b);
}
}
Re: Lesson 11 Source Files?
I have a better idea. First, read the forum rules on posting code, and then post your solution.
Either myself or somebody else will give you a hint that should lead you to the solution.
Either myself or somebody else will give you a hint that should lead you to the solution.
Chili
Re: Lesson 11 Source Files?
Just saw your code. You're really going to facepalm when you figure it out. Take a very close look at your putpixel calls and you should see the problem.
Chili
Re: Lesson 11 Source Files?
Facepalm.jpg
I put "cy + cy" and "cy - cy"....
should be "cy + y" and "cy -y"
I put "cy + cy" and "cy - cy"....
should be "cy + y" and "cy -y"
Re: Lesson 11 Source Files?
Something else I wanted rave about (and what I think is most important and essential to the learning process) is the thinking you have the students do. Hand holding doesn't do good in the long run. Thanks for not spoiling it for me and thanks for encouraging us to figure stuff out. Cya!