mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Be a little more lenient with float comparisons.
Unfortunately, Pythagorus and binary don't play well together, so rounding errors are inevetible when testing with a slope. However, 1e-6 seems to be a good epsilon (printf's %g hides it nicely :).
This commit is contained in:
parent
3a386293fc
commit
750b5ba0ed
1 changed files with 8 additions and 1 deletions
|
@ -15,6 +15,13 @@
|
|||
# include "../trace.c"
|
||||
#endif
|
||||
|
||||
#define FloatCompare(a, b) (fabs (a - b) < 1e-6)
|
||||
#undef VectorCompare
|
||||
#define VectorCompare(x, y) \
|
||||
(FloatCompare (x[0], y[0]) && FloatCompare (x[1], y[1]) \
|
||||
&& FloatCompare (x[2], y[2]))
|
||||
|
||||
|
||||
// 0,0
|
||||
// |\ .
|
||||
// |s\ .
|
||||
|
@ -515,7 +522,7 @@ nodeleaf_bail:
|
|||
trace.allsolid, trace.startsolid,
|
||||
trace.inopen, trace.inwater);
|
||||
if (VectorCompare (end, trace.endpos)
|
||||
&& test->expect.frac == trace.fraction
|
||||
&& FloatCompare (test->expect.frac, trace.fraction)
|
||||
&& test->expect.allsolid == trace.allsolid
|
||||
&& test->expect.startsolid == trace.startsolid
|
||||
&& test->expect.inopen == trace.inopen
|
||||
|
|
Loading…
Reference in a new issue