/*******************************************************
 *                                                     *
 *  draw.figure Library        GCW  27/12/94           *
 *                                                     *
 *******************************************************/

/* Uses draw.object, draw.file */

#ifndef _draw_file
#include bob:draw.file
#endif

#ifndef _draw_figure
#define _draw_figure 1
#endif

drawfile::circle(x,y,r)
{
 local a;
 a = floor(4*r*(sqrt(2.0)-1.0)/3);
 this->move(x,y+r);
 this->bezier(x+a,y+r,x+r,y+a,x+r,y);
 this->bezier(x+r,y-a,x+a,y-r,x,y-r);
 this->bezier(x-a,y-r,x-r,y-a,x-r,y);
 this->bezier(x-r,y+a,x-a,y+r,x,y+r);
 this->close_with_line();
}

drawfile::ellipse(x,y,a,b)
{
 local a1,b1;
 a1 = floor(4*a*(sqrt(2.0)-1.0)/3);
 b1 = floor(4*b*(sqrt(2.0)-1.0)/3);
 this->move(x,y+b);
 this->bezier(x+a1,y+b,x+a,y+b1,x+a,y);
 this->bezier(x+a,y-b1,x+a1,y-b,x,y-b);
 this->bezier(x-a1,y-b,x-a,y-b1,x-a,y);
 this->bezier(x-a,y+b1,x-a1,y+b,x,y+b);
 this->close_with_line();
}


/* ------------ end of figure definitions ------------- */
