I found the old thread with google, but it doesn't seem to exist when I tried to search it. However routines that were in that thread did not work as I wanted. In the search of perfect ellipse routine I made something myself:

`void S_Tile::Draw_Ellipse_Points(int cx, int cy, int x, int y, const S_Pixel &c)`

{

Set_Pixel(cx+x, cy+y, c);

Set_Pixel(cx-x, cy+y, c);

Set_Pixel(cx-x, cy-y, c);

Set_Pixel(cx+x, cy-y, c);

}

int S_Tile::Trunc(double f)

{

return (int)(f-0.5);

}

void S_Tile::Ellipse(int ox, int oy, int radius_x, int radius_y, const S_Pixel &c)

{

radius_x=abs(radius_x);

radius_y=abs(radius_y);

if (radius_x<1) radius_x=1;

if (radius_y<1) radius_y=1;

const double pi=3.14159265358979323846;

int q=radius_x;

if (q<radius_y) q=radius_y;

double a=(double)(q*q);

double d=(pi*2)/a;

for (double t=0.0; t<=pi/2; t+=d)

{

int xp=Trunc((radius_x*cos(t)));

int yp=Trunc((radius_y*sin(t)));

Draw_Ellipse_Points(ox, oy, xp, yp, c);

}

}

Edit: solved the square problem with q variable while writing this message... q*q seems to be needed for symmetry, but I'm not sure if pi*2 is right.

It's notable that this ellipse routine creates diamond shaped ellipse with small values which is what I want. Most ellipse routines create roundish or even rectangle forms with small radius.

The problem with this routine are "double pixels". The entire shape should be constructed from 1 pixel wide line through the arc.

It's ridiculously difficult to get this right! Searching internet gives "papers" that "solve" this but when trying those routines they fail especially when the ellipse is flat.