From 4ed8b69e2455637e50d96dd1db0f12fe582e6e33 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 7 Dec 2011 12:20:04 +0900 Subject: [PATCH] Check the cross product length before testing its direction. This fixes the bogus portal crossings. --- libs/models/trace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/models/trace.c b/libs/models/trace.c index a727332ed..a3e66dc21 100644 --- a/libs/models/trace.c +++ b/libs/models/trace.c @@ -211,6 +211,8 @@ point_inside_portal (const clipport_t *portal, const plane_t *plane, for (i = 0; i < points->numpoints; i++) { VectorSubtract (p, points->points[i], x); CrossProduct (x, edges->points[i], c); + if (DotProduct (c, c) < PLANE_EPSILON) + return false; if (DotProduct (c, n) <= 0) return false; }