diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2019-07-26 14:41:28 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2019-07-26 14:41:28 +0300 |
commit | 9e9c6eac6a3b4c02938f2c3e908648df23e089c3 (patch) | |
tree | 9253c8d17dc133e586b5b0f814e49d3e4505fd17 | |
parent | 11b994e26e4dbfc40dc6ff2194b7855e2eb20f23 (diff) |
Fix T67595: bevel concave cube corner.
The special case test for cube-like corner did not work if normals
are flipped.
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 90df3cd225e..c317d064086 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -3837,7 +3837,7 @@ static VMesh *make_cube_corner_adj_vmesh(BevelParams *bp) /* Is this a good candidate for using tri_corner_adj_vmesh? */ static int tri_corner_test(BevelParams *bp, BevVert *bv) { - float ang, totang, angdiff; + float ang, absang, totang, angdiff; EdgeHalf *e; int i; int in_plane_e = 0; @@ -3852,10 +3852,11 @@ static int tri_corner_test(BevelParams *bp, BevVert *bv) for (i = 0; i < bv->edgecount; i++) { e = &bv->edges[i]; ang = BM_edge_calc_face_angle_signed_ex(e->e, 0.0f); - if (ang <= M_PI_4) { + absang = fabsf(ang); + if (absang <= M_PI_4) { in_plane_e++; } - else if (ang >= 3.0f * (float)M_PI_4) { + else if (absang >= 3.0f * (float)M_PI_4) { return -1; } totang += ang; @@ -3863,7 +3864,7 @@ static int tri_corner_test(BevelParams *bp, BevVert *bv) if (in_plane_e != bv->edgecount - 3) { return -1; } - angdiff = fabsf(totang - 3.0f * (float)M_PI_2); + angdiff = fabsf(fabsf(totang) - 3.0f * (float)M_PI_2); if ((bp->pro_super_r == PRO_SQUARE_R && angdiff > (float)M_PI / 16.0f) || (angdiff > (float)M_PI_4)) { return -1; |