MLM Veraart (Veraart++at++fel.tno.nl)
Mon, 22 Mar 1999 18:57:49 +0100
It has taken me some time to find out why in some situations my
performer application shoes some very wierd behaviour.
The application use shadowmap-shadows, and it calculates a tight
frustrum for the shadow lightsource. For this frustum calculation
I have to determine a lot of angles between vectors.
To to this I use the following code snippet
pfVec3 v1,v2;
float angle;
pfNormaliseVec3(v1);
pfNormaliseVec3(v2);
angle = pfArcCos(pfDotVec3(v1,v2));
it turns out that I sometime get a result angle of nan(0x2000000).
And any further calculation with this gave wrong results.
The cause of it was that pfDotVec gave as a result a float
that was just larger than 1.0, in only a few cases.
Solution:
write your own arccos function that checks for boundaries
and then calls pfArcCos.
Mario
This archive was generated by hypermail 2.0b2 on Mon Mar 22 1999 - 09:57:01 PST