From a4e151704fe2e586a93a9beb5010cd830200b485 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 3 Dec 2015 22:32:01 +1100 Subject: [PATCH] Fix isect_point_tri_v3 w/ degenerate faces Ensure point_in_slice returns false when zero area faces are passed. --- source/blender/blenlib/intern/math_geom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index f8bcbae00b0..14e494ab2df 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2355,7 +2355,9 @@ static bool point_in_slice(const float p[3], const float v1[3], const float l1[3 sub_v3_v3v3(rp, p, v1); h = dot_v3v3(q, rp) / dot_v3v3(q, q); - return (h < 0.0f || h > 1.0f) ? false : true; + /* note: when 'h' is nan/-nan, this check returns false + * without explicit check - covering the degenerate case */ + return (h >= 0.0f && h <= 1.0f); } #if 0