🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6950

Re: Integer sine calculations?

#6950
From: John Schultz
Date: Fri, 23 Nov 1990 17:45
30 lines
2119 bytes
In <HEBRAIS.90Nov23024202@olivier.IRO.UMontreal.CA> hebrais@olivier.IRO.UMontreal.CA (Philippe Hebrais) writes:
>   In article <7336@hub.ucsb.edu> 6600mage@ucsbuxa.ucsb.edu (Orion Wilson the Passable) writes:
[stuff deleted about real-time sin's and cos's, motion paths]
>Hmmm, seems to me you could just evaluate the Taylor series
>for sine and cos in fixed point arithmetic. And also wouldn'it be
>faster to compute the pair (sine, cosine) than to compute sine and
>then cosine.
>sin(x) = 1 - (x^2)/2! + (x^4)/4! - (x^6)/6! + ...+ (-1)^k*(x^(2k))/(2k)!
>cos(x) = x - (x^3)/3! + (x^5)/5! - (x^7)/7! + ...+ (-1)^k*(x^(2k+1))/(2k+1)!
>Also, don't forget that all the balls follow the same trajectory so you need
>only worry with the "lead" ball.
>(off course, "x^n" means "x" to the power of "n" and "5!" is "1*2*3*4*5", 
>that is "n!" is "n factorial")

  Hey, mon, ya don't need tah do thot! Precompute sin and cos in a table
for 2pi (360 deg, one rev, etc). The index increment depends on how many
pseudodegrees you have in your numbering system. If you want to save space
at the expense of a little time, you only need to compute one quadrant, and
can get the other three with symmetry. Further, you don't need to even
compute the whole quadrant- intermediate values can be interpolated.
This technique is known as "look-up and interpolate" and is described in 
the book "Microcomputers, Displays, Graphics, and Animation" by Bruce
Artwick.
  The motion paths of those objects could easily by tabled. All values
would not be stored, just deltas (doesn't take much space).



  John
Technical Details
Message-ID: <5834@crash.cts.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!tut.cis.ohio-state.edu!cs.utexas.edu!swrinde!ucsd!nosc!crash!jcs
References: <7336@hub.ucsb.edu> <1990Nov21.221825.10898@mdivax1.uucp> <HEBRAIS.90Nov23024202@olivier.IRO.UMontreal.CA>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!tut.cis.ohio-state.edu!cs.utexas.edu!swrinde!ucsd!nosc!crash!jcs
From: jcs@crash.cts.com (John Schultz)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Integer sine calculations?
Message-ID: <5834@crash.cts.com>
Date: 23 Nov 90 17:45:54 GMT
References: <7336@hub.ucsb.edu> <1990Nov21.221825.10898@mdivax1.uucp> <HEBRAIS.90Nov23024202@olivier.IRO.UMontreal.CA>
Distribution: comp
Organization: Crash TimeSharing, El Cajon, CA
Lines: 30