[Pardon the cross-post, but some people in the PLUG list may be interested in this.]
PMana On Wed, 18 Sep 2002, Carlo Montoya wrote: > ... but no problem I just converted degrees > to radians by multiplying PI/180. The number PI is defined in one of the standard include files (I think <math.h>) as M_PI. The definition is many digits accurate (more than 15). > I asked because it would be cool to use real math in developing > games like Worms :) The "real math" used in MathLib is actually a fixed-degree polynomial approximation that gives 15-digit accuracy. This is to make the evaluation quick, in contrast to using infinite series truncated after the desired accuracy is reached. Of course table look up is sooo much faster, but you need a practical interpolation formula. You need to store sin and cos values for 1 deg, 2 degs, ..., 45 deg, 1 min, 2 min, .., 60 min, etc. Then you can use the identity sin(5 deg 23 min) = sin(5 deg) * cos(23 min) + cos(5 deg) * sin(45 min). People do not realize that this identity can be used for interpolation. Similar identities exist for cos(A+B), tan(A+B), etc., if you need these for interpolation. PMana _ Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph To leave: send "unsubscribe" in the body to [EMAIL PROTECTED] Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph To subscribe to the Linux Newbies' List: send "subscribe" in the body to [EMAIL PROTECTED]
