From: Rudolf Polzer Date: Fri, 19 Nov 2010 05:43:29 +0000 (+0100) Subject: also fix the unhashed case X-Git-Tag: xonotic-v0.5.0~148 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c792ef6379c9066e4c26104a64208ee1a18fe68b;p=xonotic%2Fnetradiant.git also fix the unhashed case --- diff --git a/tools/quake3/q3map2/map.c b/tools/quake3/q3map2/map.c index 9c15895c..d61f51be 100644 --- a/tools/quake3/q3map2/map.c +++ b/tools/quake3/q3map2/map.c @@ -284,7 +284,22 @@ int FindFloatPlane( vec3_t innormal, vec_t dist, int numPoints, vec3_t *points ) SnapPlane( normal, &dist, centerofweight ); for( i = 0, p = mapplanes; i < nummapplanes; i++, p++ ) { - if( PlaneEqual( p, normal, dist ) ) + if( !PlaneEqual( p, normal, dist ) ) + continue; + + /* ydnar: uncomment the following line for old-style plane finding */ + //% return i; + + /* ydnar: test supplied points against this plane */ + for( j = 0; j < numPoints; j++ ) + { + d = DotProduct( points[ j ], p->normal ) - p->dist; + if( fabs( d ) > distanceEpsilon ) + break; + } + + /* found a matching plane */ + if( j >= numPoints ) return i; }