From 6db63bdd1974dce5ae22df2d8c9fe11d60aec3cf Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Thu, 6 Jun 2013 15:56:06 +0200 Subject: [PATCH] fix to LinePlaneIntersection function - (u+v)<=1 would only allow an intersection of the triangle p0/p1/p2 Signed-off-by: Thorsten Liebig --- tools/useful.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/useful.cpp b/tools/useful.cpp index 6ebba85..2c64772 100644 --- a/tools/useful.cpp +++ b/tools/useful.cpp @@ -157,7 +157,7 @@ int LinePlaneIntersection(double* p0, double* p1, double* p2, double* l_start, d for (int n=0;n<3;++n) is_point[n] = l_start[n]*(1-dist) + l_stop[n]*dist; - if ((u<0) || (u>1) || (v<0) || (v>1) || ((u+v)>1)) + if ((u<0) || (u>1) || (v<0) || (v>1)) return 1; if ((t<0) || (t>1)) return 2;