In PlaneEqual() in map.c, being extra anal about the logic there. Previous

logic used '<=' in compare, new logic uses '<'.  This was changed for two
reasons:
1. It adheres the the true meaning of epsilon, which is something along the
lines of "the minimum value that can be added to number X such that number X
takes on a new value after the addition" in computer science.
2. Other code that compares epsilons uses strict inequality, so I don't want
to have a case where to planes are reported equal but are not snapped
together, etc.
I still have to finish looking at where else PlaneEqual() is used and fix
related problems.


git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-math-fix-experiments@403 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
rambetter 2011-01-02 06:50:58 +00:00
parent bf05f9350b
commit f17ae01a72

View file

@ -69,10 +69,14 @@ qboolean PlaneEqual( plane_t *p, vec3_t normal, vec_t dist )
de = distanceEpsilon;
/* compare */
if( fabs( p->dist - dist ) <= de &&
fabs( p->normal[ 0 ] - normal[ 0 ] ) <= ne &&
fabs( p->normal[ 1 ] - normal[ 1 ] ) <= ne &&
fabs( p->normal[ 2 ] - normal[ 2 ] ) <= ne )
// We check equality of each component since the we're using '<', not '<='
// (the epsilons may be zero). We want to use '<' intead of '<=' to be
// consistent with the true meaning of "epsilon", and also because other
// parts of the code uses this inequality.
if ((p->dist == dist || fabs(p->dist - dist) < de) &&
(p->normal[0] == normal[0] || fabs(p->normal[0] - normal[0]) < ne) &&
(p->normal[1] == normal[1] || fabs(p->normal[1] - normal[1]) < ne) &&
(p->normal[2] == normal[2] || fabs(p->normal[2] - normal[2]) < ne))
return qtrue;
/* different */