Revision: 42579
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42579
Author:   campbellbarton
Date:     2011-12-12 09:28:46 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
slight improvement to bevel, when using the edges to take the new vertex 
location into account, dont let the longer edge skew the new position.

also include an new & improved vertex placement method but left commented for 
now.

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-12 09:09:01 UTC (rev 42578)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bevel.c       
2011-12-12 09:28:46 UTC (rev 42579)
@@ -80,14 +80,52 @@
                sub_v3_v3v3(vec2, v4, v3);
        }
 
-       /*simple percentage method */
-       add_v3_v3(vec1, vec2);
-       mul_v3_fl(vec1, fac * 0.5);
+       if (1) {
+               /*simple percentage method */
 
-       if (inv)
-               negate_v3(vec1);
-       
-       add_v3_v3v3(co, vec1, l->v->co);
+
+               /* not strictly necessary, balance vectors
+                * so the longer edge doesn't skew the result,
+                * gives nicer, move event output */
+               float medium= (normalize_v3(vec1) + normalize_v3(vec2)) / 2.0f;
+               mul_v3_fl(vec1, medium);
+               mul_v3_fl(vec2, medium);
+               /* done */
+
+
+               add_v3_v3(vec1, vec2);
+               mul_v3_fl(vec1, fac * 0.5);
+
+               if (inv)
+                       negate_v3(vec1);
+
+               add_v3_v3v3(co, vec1, l->v->co);
+       }
+       else {
+               /* distance based */
+               float tvec[3];
+               float dist;
+
+               normalize_v3(vec1);
+               normalize_v3(vec2);
+
+               /* get the medium normalized direction */
+               add_v3_v3v3(tvec, vec1,vec2);
+               normalize_v3(tvec);
+
+               /* for angle calculation */
+               negate_v3(vec2);
+
+               dist= shell_angle_to_dist(angle_normalized_v3v3(vec1, vec2) * 
0.5);
+
+               mul_v3_fl(tvec, fac * dist);
+
+               if (inv)
+                       negate_v3(tvec);
+
+               add_v3_v3v3(co, tvec, l->v->co);
+
+       }
 }
 
 #define ETAG_SET(e, v, nv) (v) == (e)->v1 ? (etags[BM_GetIndex((e))].newv1 = 
(nv)) : (etags[BM_GetIndex((e))].newv2 = (nv))

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to