Path: chuka.playstation.co.uk!news From: "Rikki Prince" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: What do'you mean I have to brush up on me maths! Date: Wed, 14 Jul 1999 20:36:29 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 38 Message-ID: <7mioup$t1v11@chuka.playstation.co.uk> References: <7ko1jf$33u25@chuka.playstation.co.uk> <376fbd21.251404588@news.scea.sony.com> <7lkucs$ko217@chuka.playstation.co.uk> <7lnteg$i9a1@chuka.playstation.co.uk> <37823145.682258342@news.scea.sony.com> <7mah71$t1v6@chuka.playstation.co.uk> <378a1a59.1200158692@news.scea.sony.com> NNTP-Posting-Host: th-gt143-111.pool.dircon.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Scott Cartier wrote in message news:378a1a59.1200158692@news.scea.sony.com... > >p.s. Scott - did you find out which method (sqrt or inv_tan) was faster? > > Nope, I haven't tried that experiment. > > > >Oh and why can't you just use a simple look-up table for inv_tan? > > The problem is that the result of (dy / dx) can be any real number. > > SIN and COS are nice because you know the angle will be from 0-359 > degrees and can make a look-up table of the appropriate size. Have an > angle of 248 degrees? Simply look up array element 248 to get the SIN > & COS. > > INV_TAN is harder because the value you would use as the index is the > result of (dy / dx). This can be any real number from negative > infinity to positive infinity. How do you make a finite-sized look-up > table for such a thing? Compounding the problem is that the result > isn't linearly proportional to the input. Or, inv_tan(1) is not > merely 2 times inv_tan(0.5). > > That said, I'm sure there's a way (there always is), but I leave that > for the smarter folks. :) > Surely there's a maximum amount that can be entered, as the input is calculated from the position of a player, which is probably on the screen. You could probably work out the maximum input for the inverse tan, by taking the largest point on the screen, and using it in the calculation for the input. However, you'd have to be certain that the maximum screen width/height will be the maximum of values used in the input. > Scott >