]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Following up on r371; found another optimization for math rounding errors
authorrambetter <rambetter@8a3a26a2-13c4-0310-b231-cf6edde360e5>
Tue, 28 Dec 2010 19:26:52 +0000 (19:26 +0000)
committerrambetter <rambetter@8a3a26a2-13c4-0310-b231-cf6edde360e5>
Tue, 28 Dec 2010 19:26:52 +0000 (19:26 +0000)
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).

git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk@375 8a3a26a2-13c4-0310-b231-cf6edde360e5

tools/quake3/common/polylib.c

index 839f7ea5d1ee3071fa7aa26539cb601ceadce9f7..83cc9ed9c334f6902a5226b1b2102a4a2281367a 100644 (file)
@@ -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);