diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2019-02-15 16:32:07 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2019-02-15 16:32:07 +0300 |
commit | dd97b09fa8d5cabb3b3eeb6e3f91ef88783ddf7b (patch) | |
tree | e38ca3ce42097a3c17a4853b3dbf69617ffd756a /source/blender/bmesh | |
parent | a5cbe81bed4ff7dc2cc75a7708c532addbd4e42a (diff) |
Bevel: fix twist on bevel of cylinder with >= 200 sides.
This triggered an "almost parallel" case in setting the
offset meet points, which is OK but code needed improvement
put the meet point in a more accurate place.
This ia fix for part of the report T61214.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index a530efd51d2..7c590b1cf69 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -847,6 +847,9 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, bool e if (ang < BEVEL_EPSILON_ANG) { /* special case: e1 and e2 are parallel; put offset point perp to both, from v. * need to find a suitable plane. + * this code used to just use offset and dir1, but that makes for visible errors + * on a circle with > 200 sides, which trips this "nearly perp" code (see T61214). + * so use the average of the two, and the offset formula for angle bisector. * if offsets are different, we're out of luck: * use the max of the two (so get consistent looking results if the same situation * arises elsewhere in the object but with opposite roles for e1 and e2 */ @@ -854,10 +857,12 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, bool e copy_v3_v3(norm_v, f->no); else copy_v3_v3(norm_v, v->no); + add_v3_v3(dir1, dir2); cross_v3_v3v3(norm_perp1, dir1, norm_v); normalize_v3(norm_perp1); copy_v3_v3(off1a, v->co); d = max_ff(e1->offset_r, e2->offset_l); + d = d / cos(ang / 2.0f); madd_v3_v3fl(off1a, norm_perp1, d); copy_v3_v3(meetco, off1a); } |