GhostXoPCorp wrote:Dont question my suggestion, in fact you shouldnt care but to give a better one. Sometimes my ideas work better, and more then likely there are better alternatives. So go ahead, give them, but i dont want to hear about it. Your not the teacher, you can get a degree however for that. Until then prove your intelligence to me through work, not your suggestions. You can make something 1000 different ways, today im only giving a **** about the 1. That happens to be the one i suggested. I dont ask that you care, but if you give any improvements or lectures about it, dont tell me. Ive probably already thought about it.
You must be really mad, that post is garrulous and incoherent. Seeing as all this requires is basic trig, which was covered in precal, a class in which I got a 100, I could be the teacher. And, "you're" is the contraction for "you are;" "your" is the possessive form of "you."
Code: Select all
void set_pixel(int x, int y);
void round_rectangle(int x, int y, int width, int height, int radius)
{
for(int i = 0;i < width - 2 * radius;i++)
{
set_pixel(x + radius + i, y);
set_pixel(x + radius + i, y + height);
}
for(int i = 0;i < height - 2 * radius;i++)
{
set_pixel(x, y + radius + i);
set_pixel(x + width, y + radius + i);
}
for(int i = 0;i <= radius;i++)
{
set_pixel(x + i, (int)(y + radius - radius * sin(i * (pi/(2 * radius))));
set_pixel(x + i, (int)(y + height - radius + radius * sin(i * (pi/(2 * radius))));
set_pixel(x + width - radius + i, (int)(y + radius * sin(i * (pi/(2 * radius))));
set_pixel(x + width - radius + i, (int)(y + height - radius * sin(i * (pi/(2 * radius))));
}
}
Where's your polar coordinate based solution? Also, notice that I only used sine; there goes one of the proposed bonuses of polar.
To OP: I'm assuming you're using a top-left based coordinate system. If this is a problem, let me know. There may be some overlap by 1. If there is, tell me, and I'll fix it.
EDIT: I forgot to include the declaration of set_pixel.