Check the cross product length before testing its direction.
This fixes the bogus portal crossings.
This commit is contained in:
parent
5af88d33fe
commit
4ed8b69e24
|
@ -211,6 +211,8 @@ point_inside_portal (const clipport_t *portal, const plane_t *plane,
|
||||||
for (i = 0; i < points->numpoints; i++) {
|
for (i = 0; i < points->numpoints; i++) {
|
||||||
VectorSubtract (p, points->points[i], x);
|
VectorSubtract (p, points->points[i], x);
|
||||||
CrossProduct (x, edges->points[i], c);
|
CrossProduct (x, edges->points[i], c);
|
||||||
|
if (DotProduct (c, c) < PLANE_EPSILON)
|
||||||
|
return false;
|
||||||
if (DotProduct (c, n) <= 0)
|
if (DotProduct (c, n) <= 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue