[A89] Re: ellipses again


[Prev][Next][Index][Thread]

[A89] Re: ellipses again




That doesn't work; it creates a lot of missing vertical lines in the ellipse.  I've thought of two
things to try: 
- Have the program store every point it draws then check before drawing (sounds slow).
- Draw it on a VS normally then XOR it into the lcd_mem
jeff


--- Scott Noveck <noveck@pluto.njcc.com> wrote:
> 
> I think this might work for XOR and be a bit faster (horizontal ellipses
> will see a bigger speed change than vertical ones):
> 
> > void bresenham_ellipse(int a, int b, int cx, int cy, short Attr)
> > {
> >  long int S, T,a2,b2;
> >  int x,y;
> >
> >  a2 = a*a;
> >  b2 = b*b;
> >  x = 0;
> >  y = b;
> >  S = a2*(1-2*b) + 2*b2;
> >  T = b2 - 2*a2*(2*b-1);
> >  symmetry(x,y,cx,cy,Attr);
> >  do
> >    {
> >     if (S<0)
> >        {
> >         S += 2*b2*(2*x+3);
> >         T += 4*b2*(x+1);
> >         x++;
> >        }
> >       else if (T<0)
> >           {
> >            S += 2*b2*(2*x+3) - 4*a2*(y-1);
> >            T += 4*b2*(x+1) - 2*a2*(2*y-3);
> >            x++;
> >            y--;
> 
> add this:
> >             symmetry(x,y,cx,cy,Attr);
> ---
> 
> >           }
> >          else
> >           {
> >            S -= 4*a2*(y-1);
> >            T -= 2*a2*(2*y-3);
> >            y--;
> 
> and this:
> >             symmetry(x,y,cx,cy,Attr);
> ---
> 
> >           }
> 
> delete this:
> >     symmetry(x,y,cx,cy,Attr);
> ---
> 
> >    }
> >  while (y>0);
> > }
> 
>     -Scott
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



References: