Check the cross product length before testing its direction.

This fixes the bogus portal crossings.
This commit is contained in:
Bill Currie 2011-12-07 12:20:04 +09:00
parent 5af88d33fe
commit 4ed8b69e24

View file

@ -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;
}