[Bf-blender-cvs] [9556f61] blender-v2.73-release: Fix T43013: Flip with bridge aligned loops
Campbell Barton
noreply at git.blender.org
Tue Jan 6 10:44:37 CET 2015
Commit: 9556f6101391315b960cc0a9d366c54a93bcdd8f
Author: Campbell Barton
Date: Fri Dec 26 20:15:06 2014 +1100
Branches: blender-v2.73-release
https://developer.blender.org/rB9556f6101391315b960cc0a9d366c54a93bcdd8f
Fix T43013: Flip with bridge aligned loops
===================================================================
M source/blender/bmesh/operators/bmo_bridge.c
===================================================================
diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c
index e441747..6002dcf 100644
--- a/source/blender/bmesh/operators/bmo_bridge.c
+++ b/source/blender/bmesh/operators/bmo_bridge.c
@@ -180,20 +180,42 @@ static void bridge_loop_pair(BMesh *bm,
/* normalizing isn't strictly needed but without we may get very large values */
float no[3];
+ float dir_a_orig[3], dir_b_orig[3];
float dir_a[3], dir_b[3];
+ const float *test_a, *test_b;
- sub_v3_v3v3(dir_a,
+ sub_v3_v3v3(dir_a_orig,
((BMVert *)(((LinkData *)lb_a->first)->data))->co,
((BMVert *)(((LinkData *)lb_a->last)->data))->co);
- sub_v3_v3v3(dir_b,
+ sub_v3_v3v3(dir_b_orig,
((BMVert *)(((LinkData *)lb_b->first)->data))->co,
((BMVert *)(((LinkData *)lb_b->last)->data))->co);
/* make the directions point out from the normals, 'no' is used as a temp var */
- cross_v3_v3v3(no, dir_a, el_dir); cross_v3_v3v3(dir_a, no, el_dir);
- cross_v3_v3v3(no, dir_b, el_dir); cross_v3_v3v3(dir_b, no, el_dir);
+ cross_v3_v3v3(no, dir_a_orig, el_dir); cross_v3_v3v3(dir_a, no, el_dir);
+ cross_v3_v3v3(no, dir_b_orig, el_dir); cross_v3_v3v3(dir_b, no, el_dir);
- if (dot_v3v3(dir_a, dir_b) < 0.0f) {
+ if (LIKELY(!is_zero_v3(dir_a) && !is_zero_v3(dir_b))) {
+ test_a = dir_a;
+ test_b = dir_b;
+ }
+ else {
+ /**
+ * This is a corner case:
+ *
+ * <pre>
+ * (loop a) (loop b)
+ * +--------+ +--------+
+ * </pre>
+ *
+ * When loops are aligned to the direction between the loops values of 'dir_a/b' is degenerate,
+ * in this case compare the original directions (before they were corrected by 'el_dir'), see: T43013
+ */
+ test_a = dir_a_orig;
+ test_b = dir_b_orig;
+ }
+
+ if (dot_v3v3(test_a, test_b) < 0.0f) {
BM_edgeloop_flip(bm, el_store_b);
}
More information about the Bf-blender-cvs
mailing list