[Bf-blender-cvs] [68cdd2b] master: Fix T44961, bevel spikes out when certain angles near 180.

Howard Trickey noreply at git.blender.org
Fri Jun 5 19:03:46 CEST 2015


Commit: 68cdd2b3619399753123a7b9f7d5fcfed8d2e795
Author: Howard Trickey
Date:   Fri Jun 5 12:56:49 2015 -0400
Branches: master
https://developer.blender.org/rB68cdd2b3619399753123a7b9f7d5fcfed8d2e795

Fix T44961, bevel spikes out when certain angles near 180.

Made the test for whether one can "see" an adjacent edge less
knife-close to 180. This means it will chose to slide along
such an edge less often, and avoid some spikes.

===================================================================

M	source/blender/bmesh/tools/bmesh_bevel.c

===================================================================

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 5e4b251..6a8411d 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -782,11 +782,14 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, bool e
 	}
 }
 
+/* chosen so that 1/sin(BEVEL_GOOD_ANGLE) is about 4, giving that expansion factor to bevel width */
+#define BEVEL_GOOD_ANGLE 0.25f
+
 /* Calculate the meeting point between e1 and e2 (one of which should have zero offsets),
  * where e1 precedes e2 in CCW order around their common vertex v (viewed from normal side).
  * If r_angle is provided, return the angle between e and emeet in *r_angle.
  * If the angle is 0, or it is 180 degrees or larger, there will be no meeting point;
- * return false in that case, else true */
+ * return false in that case, else true. */
 static bool offset_meet_edge(EdgeHalf *e1, EdgeHalf *e2, BMVert *v,  float meetco[3], float *r_angle)
 {
 	float dir1[3], dir2[3], fno[3], ang, sinang;
@@ -798,7 +801,7 @@ static bool offset_meet_edge(EdgeHalf *e1, EdgeHalf *e2, BMVert *v,  float meetc
 
 	/* find angle from dir1 to dir2 as viewed from vertex normal side */
 	ang = angle_normalized_v3v3(dir1, dir2);
-	if (ang < BEVEL_EPSILON) {
+	if (fabs(ang) < BEVEL_GOOD_ANGLE) {
 		if (r_angle)
 			*r_angle = 0.0f;
 		return false;
@@ -809,10 +812,11 @@ static bool offset_meet_edge(EdgeHalf *e1, EdgeHalf *e2, BMVert *v,  float meetc
 	if (r_angle)
 		*r_angle = ang;
 
-	if (ang - (float)M_PI > BEVEL_EPSILON)
+	if (fabs(ang - (float)M_PI) < BEVEL_GOOD_ANGLE)
 		return false;
 
 	sinang = sinf(ang);
+
 	copy_v3_v3(meetco, v->co);
 	if (e1->offset_r == 0.0f)
 		madd_v3_v3fl(meetco, dir1, e2->offset_l / sinang);




More information about the Bf-blender-cvs mailing list