diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2016-09-12 14:27:29 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2016-09-12 14:29:31 +0300 |
commit | 0f8f494d637cab3802239120456c3eb58011cdff (patch) | |
tree | 7cb76a1ccf873b75e49a4e21d198c41bef08e110 /source/blender/bmesh/tools | |
parent | fb2c435d8655a4fd37b518dab2da24ef79240822 (diff) |
Fix T49296, assert failure in Bevel code.
The mesh interpolation function failed to fill a fractions-of-the-way
array properly when the distances are very small but nonzero.
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 1dfb9dee8eb..45fbfdd1767 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2194,10 +2194,13 @@ static void fill_vmesh_fracs(VMesh *vm, float *frac, int i) total += len_v3v3(mesh_vert(vm, i, 0, k)->co, mesh_vert(vm, i, 0, k + 1)->co); frac[k + 1] = total; } - if (total > BEVEL_EPSILON) { + if (total > 0.0f) { for (k = 1; k <= ns; k++) frac[k] /= total; } + else { + frac[ns] = 1.0f; + } } /* Like fill_vmesh_fracs but want fractions for profile points of bndv, with ns segments */ @@ -2215,11 +2218,14 @@ static void fill_profile_fracs(BevelParams *bp, BoundVert *bndv, float *frac, in frac[k + 1] = total; copy_v3_v3(co, nextco); } - if (total > BEVEL_EPSILON) { + if (total > 0.0f) { for (k = 1; k <= ns; k++) { frac[k] /= total; } } + else { + frac[ns] = 1.0f; + } } /* Return i such that frac[i] <= f <= frac[i + 1], where frac[n] == 1.0 |