Rockbox mail archiveSubject: Re: Re: 3D Cube screensaver - useless but nice
Re: Re: 3D Cube screensaver - useless but nice
From: David Madsen <madsend_at_myrealbox.com>
Date: Mon, 14 Oct 2002 14:30:52 -0600
Another method to generate the sine/cosine values would be to use the cordic
algorithm to calculate the values. It would be more processor intensive
than the lookup, but would result in smaller code. The algorithm goes as
X = X + Y * 2^(-i)
Y = Y + X * 2^(-i)
the angle of rotation for each iteration is atan(2^-i).. For example if i=4
the rotation is 3.6 degrees per iteration.
The X * 2^(-i) can be easily and quickly calculated using a SAR (arithmetic
shift right) if it is implemented in the processor.
as you repeatedly calculate these values, x and y will vary as the sine and
I'm not sure if this will help, as I haven't looked at your code to see how
you are using the table, but it is an interesting little algorithm anyway.
I have been lurking on this list for a while and am interested in getting
into development, but have little time due to school and work these days..
----- Original Message -----
From: "Damien Teney" <dteney_at_hotmail.com>
Sent: Monday, October 14, 2002 1:33 PM
Subject: Re: Re: 3D Cube screensaver - useless but nice
> I improved my code as you told me: now I just have one table with the sine
> from 0 to 90 degrees.
> However, Daniel suggests to avoid floats and to use integers numbers, and
> tried to do this: the sine table was an int table with the sine * 1000000,
> and when it needed a sine, I took the element of the table / 1000000.
> Furthermore, the size of the compiled module is still quite big :-(
> D a m i e n T e n e y
> Affichez, modifiez et partagez gratuitement vos photos en ligne:
Received on 2002-10-14