diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2019-05-28 14:56:56 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2019-05-28 14:56:56 +0300 |
commit | 2e211d099f8d13b79cdf9057f77532c587311c3d (patch) | |
tree | 06afdf3f4bcd233c67a915ee8c8ce293129fc1bb /source/blender | |
parent | b2b1aa2f8ead62cb376342b11348fe8495ae736d (diff) |
Fix T65141 Bevel did not curve.
The previous fix to the spike bug T64582 was not really right.
This fixes that one properly and restores the desired curving
profile in the bug's example.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index f0ffea0fbc8..2ef3f60e0a6 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -1377,31 +1377,31 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv) } } -/* Move the profile plane for bndv to the plane containing e1 and e2, which share a vert */ -static void move_profile_plane(BoundVert *bndv, EdgeHalf *e1, EdgeHalf *e2) +/* Maybe move the profile plane for bndv->ebev to the plane its profile's coa, cob and the + * original beveled vert, bmv. This will usually be the plane containing its adjacent + * non-beveled edges, but sometimes coa and cob are not on those edges. + */ +static void move_profile_plane(BoundVert *bndv, BMVert *bmv) { float d1[3], d2[3], no[3], no2[3], no3[3], dot2, dot3; + Profile *pro = &bndv->profile; - /* only do this if projecting, and e1, e2, and proj_dir are not coplanar */ - if (is_zero_v3(bndv->profile.proj_dir)) { + /* only do this if projecting, and coa, cob, and proj_dir are not coplanar */ + if (is_zero_v3(pro->proj_dir)) { return; } - sub_v3_v3v3(d1, e1->e->v1->co, e1->e->v2->co); - if (e1->is_rev) - negate_v3(d1); + sub_v3_v3v3(d1, bmv->co, pro->coa); normalize_v3(d1); - sub_v3_v3v3(d2, e2->e->v1->co, e2->e->v2->co); - if (e2->is_rev) - negate_v3(d2); + sub_v3_v3v3(d2, bmv->co, pro->cob); normalize_v3(d2); cross_v3_v3v3(no, d1, d2); - cross_v3_v3v3(no2, d1, bndv->profile.proj_dir); - cross_v3_v3v3(no3, d2, bndv->profile.proj_dir); + cross_v3_v3v3(no2, d1, pro->proj_dir); + cross_v3_v3v3(no3, d2, pro->proj_dir); if (normalize_v3(no) > BEVEL_EPSILON_BIG && normalize_v3(no2) > BEVEL_EPSILON_BIG && normalize_v3(no3) > BEVEL_EPSILON_BIG) { dot2 = dot_v3v3(no, no2); dot3 = dot_v3v3(no, no3); - if (fabsf(dot2) < 0.95f && fabsf(dot3) < 0.95f) { + if (fabsf(dot2) < (1 - BEVEL_EPSILON_BIG) && fabsf(dot3) < (1 - BEVEL_EPSILON_BIG)) { copy_v3_v3(bndv->profile.plane_no, no); } } @@ -2354,7 +2354,7 @@ static void build_boundary_terminal_edge(BevelParams *bp, /* special case: snap profile to plane of adjacent two edges */ v = vm->boundstart; BLI_assert(v->ebev != NULL); - move_profile_plane(v, v->next->elast, v->efirst); + move_profile_plane(v, bv->v); calculate_profile(bp, v); } |