Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Trickey <howard.trickey@gmail.com>2019-05-25 16:41:29 +0300
committerHoward Trickey <howard.trickey@gmail.com>2019-05-25 16:41:29 +0300
commite1d1899e7290a933e23243201ae2267a9efb996f (patch)
treeda6ba2206e70eeb4a871529dbfe051ed5020f012 /source/blender/bmesh/tools
parent26c317b666001b35eefec7ad760a4bf99f09a397 (diff)
Fix T64582: bevel spikes sometimes
The code to move the profile plane needed to not do that in a few more cases.
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index a559d13fc70..088acbbce9b 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1256,6 +1256,8 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
pro->super_r = bp->pro_super_r;
/* projection direction is direction of the edge */
sub_v3_v3v3(pro->proj_dir, e->e->v1->co, e->e->v2->co);
+ if (e->is_rev)
+ negate_v3(pro->proj_dir);
normalize_v3(pro->proj_dir);
project_to_edge(e->e, co1, co2, pro->midco);
if (DEBUG_OLD_PROJ_TO_PERP_PLANE) {
@@ -1378,19 +1380,28 @@ 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)
{
- float d1[3], d2[3], no[3], no2[3], dot;
+ float d1[3], d2[3], no[3], no2[3], no3[3], dot2, dot3;
/* only do this if projecting, and e1, e2, and proj_dir are not coplanar */
if (is_zero_v3(bndv->profile.proj_dir)) {
return;
}
sub_v3_v3v3(d1, e1->e->v1->co, e1->e->v2->co);
+ if (e1->is_rev)
+ negate_v3(d1);
+ normalize_v3(d1);
sub_v3_v3v3(d2, e2->e->v1->co, e2->e->v2->co);
+ if (e2->is_rev)
+ negate_v3(d2);
+ normalize_v3(d2);
cross_v3_v3v3(no, d1, d2);
cross_v3_v3v3(no2, d1, bndv->profile.proj_dir);
- if (normalize_v3(no) > BEVEL_EPSILON_BIG && normalize_v3(no2) > BEVEL_EPSILON_BIG) {
- dot = fabsf(dot_v3v3(no, no2));
- if (fabsf(dot - 1.0f) > BEVEL_EPSILON_BIG) {
+ cross_v3_v3v3(no3, d2, bndv->profile.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) {
copy_v3_v3(bndv->profile.plane_no, no);
}
}
@@ -2340,7 +2351,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->efirst, v->next->elast);
+ move_profile_plane(v, v->next->elast, v->efirst);
calculate_profile(bp, v);
}