positioning pie slice problems

Because I really don’t understand Turbo C++ I can’t say for sure. But I think this is your solution:

void Circular_arc(constint h, constint k, constint r, constint start_angle, constint end_angle)
{
    static int offset = 0;

    start_angle = (start_angle + offset) % 360;
    end_angle = (end_angle + offset) % 360;
    offset = end_angle;

    int color = getcolor();

    float angle = (((start_angle <= end_angle) ? start_angle : end_angle)*(M_PI / 180));
    float range = (((end_angle > start_angle) ? end_angle : start_angle)*(M_PI / 180));

    float x = (r*cos(angle));
    float y = (r*sin(angle));

    do
    {
        putpixel((int)(h + x + 0.5), (int)(k - y + 0.5), color);

        angle += 0.001;

        x = (r*cos(angle));
        y = (r*sin(angle));
    } while (angle <= range);
}

Let me also say that this is a horrible solution in that it is in no way object oriented. But it seems to be the best you can do without starting over (which you should do.)

Browse More Popular Posts

Leave a Comment