im not sure, but ive figured out a way to write sine and cosine approximations using the fast_sqrt
EDIT:
This is what I had in mind, for a simple function, for an angle between 0 and 90 degrees
cos(theta)^2 + sin(theta)^2 = 1
so therefore (90-theta) / 90 = cos(theta)^2
so therefore you could say the cosine is:
fast_sqrt((90-theta)/90)
obviously this isn't totally accurate, even if you used the real sqrt method. here's a table of sqrt((90-theta)/90) vs the real cosine of theta, from 0 to 90 degrees in steps of 10 degrees, my method on the left and the real cosine on the right
Code:
0 degrees
mine = 1, real = 1
.94281, .98481
.88192, .93969
.8165, .86603
.74536, .76604
.66667, .64279
.57735, .5
.4714, .34202
.33333, .17365
0
Sometime it's pretty close, sometimes the difference is too big. If you did that with the fast_sqrt method you could call this function probably 100,000 times, vs 2,000 times per frame, and not notice a difference, plus you could find a function to model the difference between the real and accepted and apply that to the approximation to get an even closer value to the real thing, but ultimately it's just better to call sine and cosine and just code smart instead of inventing hacks like this before you get a real problem