The grid is just:
Code:
Your #includes up here: stdio.h and math.h
#defines down here: I used Cx (x value of the center point), and
Cy (vertical value of the center point.
Several others for Tread, Sidewall, Inside, etc., parts of the tire.
And ROWS and COLS for the array itself.
I moved the center of the tire from 10,10 to 12, 30 so it
could be better centered, and let me draw a bigger tire.
I used long int's for i, c, base, height, hyp.
char w[ROWS][COLS]; //declare the w(heel) array
for(r=0; r < ROWS;r++) {
for(c=0; c<COLS; c++) {
//arithmetic in here
if(hyp > Tread) w[r][c] = ' '; //a blank space for outside the tire
else if(hyp <= Tread and > Sidewall) w[r][c]='$';
else if(hyp .... etc. like that. Step down through every part of the tire.
}
printf("\n");
}
All calculations are done, now draw it.
for(r=0; r< ROWS;r++)
for(c=0; c<COLS;c++)
printf("%c", w[r][c]);
That's really all there is to it. Hard part is getting the math to work out, since the fonts are usually NOT square. (as noted in the previous post).