1 May 2007 01:05
[Bug 10783] Missing ArcSine and ArcCosine capability in GLSL
<bugzilla-daemon <at> freedesktop.org>
2007-04-30 23:05:17 GMT
2007-04-30 23:05:17 GMT
http://bugs.freedesktop.org/show_bug.cgi?id=10783 ------- Comment #2 from idr <at> us.ibm.com 2007-04-30 16:05 PST ------- I did a bit of research on the net, and I think asin, acos, and atan can be approcimated pretty easilly. This should make the GLSL to GL_ARB_{fragment,vertex}_program conversion pretty simple: asin(x) = pi/2 - sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3) acos(x) = sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3) where a0 = 1.5707288 a1 = -0.2121144 a2 = 0.0742610 a3 = -0.0187293 atan(y, x) = s * ( pi/4 - (pi / 4) * ((x - |y|) / (x + |y|))) for x >= 0 s * (3pi/4 - (pi / 4) * ((x + |y|) / (|y| - x))) for x < 0 where s = -1 for y < 0 s = 1 otherwise References: http://mathforum.org/library/drmath/view/54137.html http://dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm http://en.wikipedia.org/wiki/Arcsin#Recommended_method_of_calculation(Continue reading)
RSS Feed