[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44237] branches/bmesh/blender/source/ blender/bmesh/operators/bmo_bevel.c: fix for issue with bevel when the 2 edges form a straight line.
Campbell Barton
ideasman42 at gmail.com
Sun Feb 19 05:14:04 CET 2012
Revision: 44237
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44237
Author: campbellbarton
Date: 2012-02-19 04:13:52 +0000 (Sun, 19 Feb 2012)
Log Message:
-----------
fix for issue with bevel when the 2 edges form a straight line. this isnt really fixing the bigger problems but the error did show up baddly as an artifact.
Modified Paths:
--------------
branches/bmesh/blender/source/blender/bmesh/operators/bmo_bevel.c
Modified: branches/bmesh/blender/source/blender/bmesh/operators/bmo_bevel.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/bmo_bevel.c 2012-02-19 03:19:58 UTC (rev 44236)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bmo_bevel.c 2012-02-19 04:13:52 UTC (rev 44237)
@@ -100,7 +100,9 @@
normalize_v3(l_vec_next);
add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next);
- normalize_v3(co_ofs);
+ if (UNLIKELY(normalize_v3(co_ofs) == 0.0f)) { /* edges form a straignt line */
+ cross_v3_v3v3(co_ofs, l_vec_prev, l->f->no);
+ }
if (do_even) {
negate_v3(l_vec_next);
@@ -119,18 +121,31 @@
*
* 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 */
+ float angle;
+ if (do_even) {
+ negate_v3(l_vec_next);
+ angle = angle_normalized_v3v3(l_vec_prev, l_vec_next);
+ negate_v3(l_vec_next); /* no need unless we use again */
+ }
+ else {
+ angle = 0.0f;
+ }
+
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);
+ if (UNLIKELY(is_zero_v3(co_ofs))) {
+ cross_v3_v3v3(co_ofs, l_vec_prev, l->f->no);
+ normalize_v3(co_ofs);
+ mul_v3_fl(co_ofs, min_fac);
+ }
+
/* done */
if (do_even) {
- negate_v3(l_vec_next);
mul_v3_fl(co_ofs, (fac * 0.5) * shell_angle_to_dist(0.5f * angle));
- /* negate_v3(l_vec_next); */ /* no need unless we use again */
}
else {
mul_v3_fl(co_ofs, fac * 0.5);
More information about the Bf-blender-cvs
mailing list