Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-06-06 01:31:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-06 01:31:01 +0400
commit4835f63be28331dfe3d1f946a90801ddb925b257 (patch)
treeaec271857f74965463f6b42ac569d6b0383d16c6 /source/blender/bmesh/intern/bmesh_edgeloop.c
parent71758cb5d7fee4f3affa9822050525f79f14a9fb (diff)
fix issue with new bridge tool interpolation [#35636]
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_edgeloop.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_edgeloop.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c
index 91812fb2cff..dc3a223ae5d 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.c
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.c
@@ -47,7 +47,7 @@ typedef struct BMEdgeLoopStore {
} BMEdgeLoopStore;
#define BM_EDGELOOP_IS_CLOSED (1 << 0)
-
+#define EDGELOOP_EPS 0.00001f
/* -------------------------------------------------------------------- */
/* BM_mesh_edgeloops_find & Util Functions */
@@ -580,7 +580,7 @@ void BM_edgeloop_calc_center(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
}
-void BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
+bool BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
{
LinkData *node_curr = el_store->verts.first;
float const *v_prev = NODE_AS_CO(el_store->verts.last);
@@ -601,8 +601,13 @@ void BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
}
} while (true);
- if (UNLIKELY(normalize_v3(el_store->no) == 0.0f)) {
+ if (UNLIKELY(normalize_v3(el_store->no) < EDGELOOP_EPS)) {
el_store->no[2] = 1.0f; /* other axis set to 0.0 */
+ return false;
+
+ }
+ else {
+ return true;
}
}
@@ -612,7 +617,7 @@ void BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
*
* Instead use an alignment vector and calculate the normal based on that.
*/
-void BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store, const float no_align[3])
+bool BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store, const float no_align[3])
{
LinkData *node_curr = el_store->verts.first;
float const *v_prev = NODE_AS_CO(el_store->verts.last);
@@ -637,8 +642,12 @@ void BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm), BMEdgeLoopStore *el_stor
}
} while (true);
- if (UNLIKELY(normalize_v3(el_store->no) == 0.0f)) {
+ if (UNLIKELY(normalize_v3(el_store->no) < EDGELOOP_EPS)) {
el_store->no[2] = 1.0f; /* other axis set to 0.0 */
+ return false;
+ }
+ else {
+ return true;
}
}