From 887435af2b18f9a300b7682be0ef9c376e1fd0c1 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 28 Dec 2010 20:31:25 +0100 Subject: [PATCH] Fix by Rambetter (svn r371): Following up on r371; found another optimization for math rounding errors in BaseWindingForPlane(). This allows me to get rid of an extra call to VectorSetLength() which contain floating point multiplications. Behavior of BaseWindingForPlane() has been verified against base_winding regression test (comparing output w/ logging patch). --- tools/quake3/common/polylib.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/quake3/common/polylib.c b/tools/quake3/common/polylib.c index b62d12ff..7d5b8a83 100644 --- a/tools/quake3/common/polylib.c +++ b/tools/quake3/common/polylib.c @@ -253,13 +253,9 @@ winding_t *BaseWindingForPlane (vec3_t normal, vec_t dist) vright[2] = normal[1]; break; } - CrossProduct(normal, vright, vup); - - // IMPORTANT NOTE: vright and vup are NOT unit vectors at this point. - // However, normal, vup, and vright are pairwise perpendicular. - - VectorSetLength(vup, MAX_WORLD_COORD * 2, vup); + // NOTE: vright is NOT a unit vector at this point. VectorSetLength(vright, MAX_WORLD_COORD * 2, vright); + CrossProduct(normal, vright, vup); VectorScale(normal, dist, org); w = AllocWinding(4); -- 2.39.2