[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42619] branches/bmesh/blender/source/ blender/bmesh/operators/bevel.c: when calculating the size to bevel when the factor is measured against the face , use the shorter edge rather then the middle.

Campbell Barton ideasman42 at gmail.com
Wed Dec 14 01:43:55 CET 2011


Revision: 42619
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42619
Author:   campbellbarton
Date:     2011-12-14 00:43:42 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
when calculating the size to bevel when the factor is measured against the face, use the shorter edge rather then the middle.

this reduces overlapping geometry.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/operators/bevel.c

Modified: branches/bmesh/blender/source/blender/bmesh/operators/bevel.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/bevel.c	2011-12-14 00:30:31 UTC (rev 42618)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bevel.c	2011-12-14 00:43:42 UTC (rev 42619)
@@ -97,12 +97,14 @@
 
 		/* not strictly necessary, balance vectors
 		 * so the longer edge doesn't skew the result,
-		 * gives nicer, move even output */
-		float medium= (normalize_v3(l_vec_prev) + normalize_v3(l_vec_next)) / 2.0f;
+		 * gives nicer, move even output.
+		 *
+		 * Use the minimum rather then the middle value so skinny faces don't flip along the short axis */
+		float min_fac= minf(normalize_v3(l_vec_prev), normalize_v3(l_vec_next));
 		float angle= do_even ? angle_normalized_v3v3(l_vec_prev, l_vec_next) : 0.0f; /* get angle while normalized */
 
-		mul_v3_fl(l_vec_prev, medium);
-		mul_v3_fl(l_vec_next, medium);
+		mul_v3_fl(l_vec_prev, min_fac);
+		mul_v3_fl(l_vec_next, min_fac);
 
 		add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next);
 




More information about the Bf-blender-cvs mailing list