🔒 Locked
math optimizations
Advertisement
Original Post
Did you try book "Game programming Gems" ? I found there a few very good math tricks. ( e.g. very fast float to int casting )
go to your favoured book store and check for "game programming gems", edited by Mark DeLoura (3 was by Dante Treglia).
if i remember correctly those math tricks were in the first book.
here is the amazon-link to the first book of the "game programming gems".
[edited by - OmniBrain on February 25, 2003 5:20:49 AM]
if i remember correctly those math tricks were in the first book.
here is the amazon-link to the first book of the "game programming gems".
[edited by - OmniBrain on February 25, 2003 5:20:49 AM]
i am at home now with my beloved books and checekd it. it is in GPG II where you find the math tricks.
and DarkPixel: no. they do not use Taylor series. (at least i haven''t seen any when i checked)
they show some bit-modifying with ieee-floatpoints, like the fast invsqrt(), some sin/cosin-tables and the like.
and DarkPixel: no. they do not use Taylor series. (at least i haven''t seen any when i checked)
they show some bit-modifying with ieee-floatpoints, like the fast invsqrt(), some sin/cosin-tables and the like.
I''m sorry, it seems i was wrong
...
Anonymous Poster is right ! Taylor isn''t always the best
optmization, but in many cases its still a good and fast approximation...
...If you want more info on ''Taylor Series'' you can check
2.3 Polynomial Approximation to Trigonometric Functions in the
Game Programming Gems book on page 161.
There is no problem, only solutions...
Anonymous Poster is right ! Taylor isn''t always the best
optmization, but in many cases its still a good and fast approximation...
...If you want more info on ''Taylor Series'' you can check
2.3 Polynomial Approximation to Trigonometric Functions in the
Game Programming Gems book on page 161.
There is no problem, only solutions...
The infinite taylor series for sin(x) for a = 0 is equivalent to sin(x) (in that the radius of convergence is infinite). That said taylor series are not an optimization, they are used for approximation / an easier way to calculate difficult functions. Also, you can''t find the tayler series of a function that is not differentiable (or continuous but that''s a given).
I know its not really an optimization, but I hardcoded my lookup tables to keep imports down. I successfully made a simple wireframe 3d program in 2k!
look_sin[1] = 0.0174519f;
look_sin[2] = 0.0348985f;
look_sin[3] = 0.0523344f;
etc....the reason for the size is actually because I Ignored Default Libraries, then made my own CRT...i called it the anemicCRT, because all it has is memory functions (new, delete, heap management)
Brian
look_sin[1] = 0.0174519f;
look_sin[2] = 0.0348985f;
look_sin[3] = 0.0523344f;
etc....the reason for the size is actually because I Ignored Default Libraries, then made my own CRT...i called it the anemicCRT, because all it has is memory functions (new, delete, heap management)
Brian
I know its not really an optimization, but I hardcoded my lookup tables to keep imports down. I successfully made a simple wireframe 3d program in 2k!
look_sin[1] = 0.0174519f;
look_sin[2] = 0.0348985f;
look_sin[3] = 0.0523344f;
etc....the reason for the size is actually because I Ignored Default Libraries, then made my own CRT...i called it the anemicCRT, because all it has is memory functions (new, delete, heap management)
Brian
look_sin[1] = 0.0174519f;
look_sin[2] = 0.0348985f;
look_sin[3] = 0.0523344f;
etc....the reason for the size is actually because I Ignored Default Libraries, then made my own CRT...i called it the anemicCRT, because all it has is memory functions (new, delete, heap management)
Brian
I believe the CORDIC algorithm is used for Sin/Cos stuff (that is, by the processor)
Fourier series are nice, but for optimisations... they might be a bit of a handful given their insane number of trig functions
I think a solid grounding in maths is what you need for doing that type of optimisation, but in general, if the success of your program depends on a line level (as opposed to algorithm level) optimisation, then you are probably doing something wrong.
Trying is the first step towards failure.
Fourier series are nice, but for optimisations... they might be a bit of a handful given their insane number of trig functions
I think a solid grounding in maths is what you need for doing that type of optimisation, but in general, if the success of your program depends on a line level (as opposed to algorithm level) optimisation, then you are probably doing something wrong.
Trying is the first step towards failure.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement