Path: chuka.playstation.co.uk!news From: James Shaughnessy Newsgroups: scee.yaroze.beginners Subject: Re: angles, angles Date: Fri, 20 Nov 1998 03:50:45 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 37 Message-ID: <3654E715.74C8@manc.u-net.com> References: <72spa7$dvm12@chuka.playstation.co.uk> <72sr28$dvm13@chuka.playstation.co.uk> <3652971c.228584498@news.playstation.co.uk> <731up3$olq9@chuka.playstation.co.uk> Reply-To: james@manc.u-net.com NNTP-Posting-Host: manc.u-net.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0 (Win95; I) Darren Jackson wrote: > ONE=4096=1degree, right? > should I convert to degrees before using it in sin and cos? It depends on what your sin/cos library uses. If you use my SINCOS.H lookup tables (see SCBUILD from my page plug plug ;-) ) then you can divide a full circle into whatever you want, including degrees if you wish: "scbuild 360" gives proper 'degree' tables, so to do sin(90 degrees) just do: SIN[90] in your program. If you use "scbuild 1024" then sin(90 degrees) is SIN[256]. (I assume you are aware that "SIN[]" is just an array, and not a slow maths function like "sin()") The result of SIN[] is multiplied by 4096 as the fixed point scaling function (nothing to do with the angle argument which I think you are confusing it with), so when you want to refer to it in it's "true" form, you must bitshift it right 12 times: (SIN[angle]>>12) There's no reason why you should use degrees though, it's best and more accurate to use say 1024. For more accuracy (but more memory) use 4096 for a full circle. (SIN[4096] and COS[4096] tables would add 32Kb to the executable so not too bad anyhoo) Then use a pencil to ram up your nose to mash up the part of the brain that always wants to think in degrees. The only reason a circle was divided into 360 was because it was "quite near" to how many days that are in a year you know. End of history lesson. 8-) 4096 is dead easy to get used to though (1024 right-angle), just be glad we don't have to use RADIANS! (or that mutant Gradian..) Jim (aka: Joey Joe Joe Junior Shabadoo) -- ----------------------------------------- James Shaughnessy james@manc.u-net.com http://www.netyaroze-europe.com/~shaughnj -----------------------------------------