From 585cfff87ad8e996b336e8522efb1bce86cce567 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 12 Sep 2012 13:06:28 +0000 Subject: Fix #32031: particle distribution on degenerate faces could give NaN values, which in this case caused NaN values in render lighting. --- source/blender/blenlib/intern/math_geom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 76f4f26b728..53e9a6b66cb 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2229,7 +2229,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[ t2 = mean_value_half_tan_v3(co, vmid, vnext); len = len_v3v3(co, vmid); - w[i] = (t1 + t2) / len; + w[i] = (len != 0.0f)? (t1 + t2) / len: 0.0f; totweight += w[i]; } @@ -2257,7 +2257,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[ t2 = mean_value_half_tan_v2(co, vmid, vnext); len = len_v2v2(co, vmid); - w[i] = (t1 + t2) / len; + w[i] = (len != 0.0f)? (t1 + t2) / len: 0.0f; totweight += w[i]; } -- cgit v1.2.3