On Wed, 4 Nov 1998, Scott Dattalo wrote: > On Wed, 4 Nov 1998, Peter L. Peres wrote: > > > Hello, > > > > a reasonably bright idea has just struck me. I have been following this > > thread for some time and I am familiar with the table method of generating > > a sine (quarter wave stored). > > > > My idea is, that since the Bresenham circle algorythm exists, it is > > possible to compute the 'next' value for a phase continuous sine wave > > without storing any table and by obtaining results directly in integers > > (no floats no lookups no nothing). > > Enlighten my ignorance, what the hell is the 'Brensenham circle > algorithm'? From context, I presume it's a recursive algorithm useful for > computing the x & y coordinates of a circle as you equidistant (i.e. No, it's an incremental algorythm that computes the y for a given x in a Cartesian space such that when x varies from 0 to N y is the corresp. sinus. If you plot x,y as you calculate them you obtain 1/8 circle. There is also one for ellipses, straights and some more stuff. Look it up, you will like it VERY much, I am sure ;) > equiangular) steps. If that's the case, then it's not too unsimilar to the > goertzel algorithm. The problem I've found with the goertzel algorithm is I don't know the Goertzel. I'll look it up. > that round off errors gradually increase to the point where sines and > cosines are no longer produced. If you're computing a few cycles of sines > and cosines, then the goertzel algorithm is great: it's fast and > efficient. Nono. The Bresenham computes nicely. The only problem is the joinery for 1/8 circles which includes a parity problem and must be solved separately (for 1 point per circle). > And I suspect because of round off errors you'd have to repeat this > quarter circle calculation every quarter of a circle - unless of course > you store the results in an array. But if you do that, you might as well > implement the array... It's incremental, mister. You compute it for 1/8 circle = 1/8 sine = 45 degrees. The trick is, that it does not yield a sine directly, but the sine is included in the result (already scaled and integer). I'll try to elaborate on this. imho this algorythm can divide the required table space for a 1/4 sine by 4. On a PIC this should be significant. Later. Peter