Logo Search packages:      
Sourcecode: libcaca version File versions  Download package

void caca_draw_ellipse ( int  xo,
int  yo,
int  a,
int  b,
char  c 
)

Draw an ellipse on the screen using the given character.

Parameters:
xo Center X coordinate.
yo Center Y coordinate.
a Ellipse X radius.
b Ellipse Y radius.
c Character to draw the ellipse outline with.
Returns:
void

Definition at line 134 of file conic.c.

{
    int d2;
    int x = 0;
    int y = b;
    int d1 = b*b - (a*a*b) + (a*a/4);

    ellipsepoints(xo, yo, x, y, c);

    while(a*a*y - a*a/2 > b*b*(x+1))
    {
        if(d1 < 0)
        {
            d1 += b*b*(2*x+1); /* XXX: "Computer Graphics" has + 3 here. */
        }
        else
        {
            d1 += b*b*(2*x*1) + a*a*(-2*y+2);
            y--;
        }
        x++;
        ellipsepoints(xo, yo, x, y, c);
    }

    d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b;
    while(y > 0)
    {
        if(d2 < 0)
        {
            d2 += b*b*(2*x+2) + a*a*(-2*y+3);
            x++;
        }
        else
        {
            d2 += a*a*(-2*y+3);
        }

        y--;
        ellipsepoints(xo, yo, x, y, c);
    }
}


Generated by  Doxygen 1.6.0   Back to index