http://bugs.freedesktop.org/show_bug.cgi?id=10783
------- Comment #4 from [EMAIL PROTECTED] 2007-04-30 19:16 PST -------
(In reply to comment #2)
> 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
>
In this case, I would defer to whatever the community wants to do here.
(Assuming the math here is correct, and I have not checked it.) It would
appear that this solution is faster than a typical asin/acos implemented by
most compilers. We do similiar sorts of approximations here for our realtime
applications, but we often use 6th order expressions.
It does seem that this approach is out of sync with the remainder of the MESA
GLSL approach, using the _mesa_XXX functions which call the standard C math
functions. In the patch I am using here, I stuck with the current approach for
the sake of consistency.
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev