dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Re: 3D Cube screensaver - useless but nice
From: David Madsen (
Date: 2002-10-14

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..

David Madsen

----- Original Message -----
From: "Damien Teney" <>
To: <>
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:

Page was last modified "Jan 10 2012" The Rockbox Crew