From b91568bbdd761d954463103ee57ab4d6ba5ec8cf Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Aug 2010 21:41:04 +0900 Subject: [PATCH] More non-canonical checks in PlaneTypeForNormal. --- tools/qfbsp/source/brush.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 6f8986182..255d72731 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -137,6 +137,7 @@ int PlaneTypeForNormal (const vec3_t normal) { float ax, ay, az; + int type; // NOTE: should these have an epsilon around 1.0? if (normal[0] == 1.0) @@ -153,10 +154,14 @@ PlaneTypeForNormal (const vec3_t normal) az = fabs(normal[2]); if (ax >= ay && ax >= az) - return PLANE_ANYX; - if (ay >= ax && ay >= az) - return PLANE_ANYY; - return PLANE_ANYZ; + type = PLANE_ANYX; + else if (ay >= ax && ay >= az) + type = PLANE_ANYY; + else + type = PLANE_ANYZ; + if (normal[type - PLANE_ANYX] < 0) + Sys_Error ("PlaneTypeForNormal: not a canonical vector"); + return type; } #define DISTEPSILON 0.01