diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-03 14:32:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-03 14:37:46 +0300 |
commit | a4e151704fe2e586a93a9beb5010cd830200b485 (patch) | |
tree | 9d88628c379863b515f3e6bf04d81d0421ac515c | |
parent | 59e4a56d87a026fee008f152dff85ec62198c7a9 (diff) |
Fix isect_point_tri_v3 w/ degenerate faces
Ensure point_in_slice returns false when zero area faces are passed.
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 |