From c792ef6379c9066e4c26104a64208ee1a18fe68b Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 19 Nov 2010 06:43:29 +0100 Subject: [PATCH] also fix the unhashed case --- tools/quake3/q3map2/map.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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; } -- 2.39.2