Re: [AD] Bug in arc()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Eric Botcazou wrote:
> 
> The bugs have indeed chilling effects in your test program! The patch looks
> ok, except the following minor points:
> 
> + /* polar_to_cartesian:
> +  *  Does '*out_x = r * sin(a)', '*out_y = r * cos(a)', where r is an integer,
> +  *  a is a fixed point angle, and *out_x and *out_y are integers.
> +  */
> + static INLINE void _polar_to_cartesian(int r, fixed a, int *out_x, int *out_y)
> + {
> +    double s, c;
> +    double double_a = a * (AL_PI * 2 / (1 << 24));
> +    s = sin(double_a);
> +    c = cos(double_a);
> +    s = -s * r;
> +    c = c * r;
> +    *out_x = (int)((c < 0) ? (c - 0.5) : (c + 0.5));
> +    *out_y = (int)((s < 0) ? (s - 0.5) : (s + 0.5));
> + }

While waiting for al_sincos(), how about using sincos() under DJGPP (and BCC32).
Btw, this al_sincos must be coded in assembler, without calling the FPU, right?
I once wrote it, but it was not too precise. However, it might be helpful for a
start...

Just wondering, shouldn't DEBUGMODE test if a pointer is NULL before using it? I
always thought that, by setting something to debug, it will do internal tests to
prevent crashes. In this function it is irrelevant, because it can only be used
by Allegro, but others, like do_arc, should IMHO assert if a pointer is NULL.

Ain't I right?


--
Roberto Alfonso (rpgrca@xxxxxxxxxx <> rpgrca@xxxxxxxxxx)
Rhynox, the Noble Rockfriend, Wild Battlerager of the Neidar Clan and
Proficient Blacksmith, rising hero, male dwarf (Genesis is the key)
ICQ: 44361979



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/