diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-20 23:32:31 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-20 23:32:31 +0400 |
commit | 577bef62eb8fcce97d2ae2bbcb4f0732596f4369 (patch) | |
tree | 8a33d7a2921385e580287a422ed7552b41aa8021 /source/blender/blenlib/intern | |
parent | b26d3f371a0de486f7147e580695c60b03c37825 (diff) |
Fix #30543: tessellating ngons with small angles was failing. There was a quite
arbitrary limit of pi/24 for picking 3 vertices to use for computing a normal,
now it uses vertices with the maximum angle between them.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 6a20d858214..420481f165b 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -872,30 +872,29 @@ int BLI_edgefill(short mat_nr) /* just use the first three different vertices */ /* THIS PART STILL IS PRETTY WEAK! (ton) */ - + eve= fillvertbase.last; len= 0.0; v1= eve->co; v2= 0; eve= fillvertbase.first; - limit = a < 5 ? FLT_EPSILON*200 : M_PI/24.0; + limit = 1e-8f; + while(eve) { if(v2) { - if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) { + if(!compare_v3v3(v2, eve->co, COMPLIMIT)) { float inner = angle_v3v3v3(v1, v2, eve->co); - - if (fabsf(inner-M_PI) < limit || fabsf(inner) < limit) { - eve = eve->next; - continue; - } + inner = MIN2(fabsf(inner), fabsf(M_PI - inner)); - len= normal_tri_v3( norm,v1, v2, eve->co); - if(len != 0.0f) break; + if(inner > limit) { + limit = inner; + len= normal_tri_v3(norm, v1, v2, eve->co); + } } } - else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) { + else if(!compare_v3v3(v1, eve->co, COMPLIMIT)) v2= eve->co; - } + eve= eve->next; } |