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>2014-02-28 20:05:53 +0400
committerHoward Trickey <howard.trickey@gmail.com>2014-02-28 22:56:17 +0400
commit1582dd5e4d7c1cb395b8ad48cc61f2b41af43d4b (patch)
treea2b4562385562868126a1c247c3fc38128eeba4f
parentda5e6b98c9991c7f113e97bbf856e7bc0161bcc0 (diff)
Partial fix for T38871, Bevel could create a far-out spike.
There needed to be a check that when a newly created point is supposed to be on an edge, that it stays within the bounds of either end of the edge. This fixes the hole-in-cube example in the bug, but not the boolean modifier one, which still needs more work.
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index ba289bb4de4..dcb604056fa 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -552,6 +552,15 @@ static void slide_dist(EdgeHalf *e, BMVert *v, float d, float slideco[3])
madd_v3_v3fl(slideco, dir, -d);
}
+/* Is co not on the edge e? */
+static bool is_outside_edge(EdgeHalf *e, const float co[3])
+{
+ float d_squared;
+
+ d_squared = dist_squared_to_line_segment_v3(co, e->e->v1->co, e->e->v2->co);
+ return d_squared > BEVEL_EPSILON_SQ;
+}
+
/*
* Calculate the meeting point between the offset edges for e1 and e2, putting answer in meetco.
* e1 and e2 share vertex v and face f (may be NULL) and viewed from the normal side of
@@ -633,6 +642,20 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, float
if (fabsf(d - e2->offset_l) > BEVEL_EPSILON)
e2->offset_l = d;
}
+ else {
+ /* The lines intersect, but is it at a reasonable place?
+ * One problem to check: if one of the offsets is 0, then don't
+ * want an intersection that is outside that edge itself.
+ * This can happen if angle between them is > 180 degrees. */
+ if (e1->offset_r == 0.0f && is_outside_edge(e1, meetco)) {
+ copy_v3_v3(meetco, v->co);
+ e2->offset_l = 0.0f;
+ }
+ if (e2->offset_l == 0.0f && is_outside_edge(e2, meetco)) {
+ copy_v3_v3(meetco, v->co);
+ e1->offset_r = 0.0f;
+ }
+ }
}
}