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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-09-26 05:59:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-26 05:59:23 +0300
commitaba2f8ea67d8c886bbe29f47e44d9e6838e32f25 (patch)
tree1544a39632fab570ee199381ebf3175f1139f8c1 /source
parente40e29cd38afdfd3e5e60712f97c4c3f92874058 (diff)
Beauty fill was skipping small faces
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/polyfill2d_beautify.c7
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/polyfill2d_beautify.c b/source/blender/blenlib/intern/polyfill2d_beautify.c
index b563e286a48..5f6fb8e6cd4 100644
--- a/source/blender/blenlib/intern/polyfill2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill2d_beautify.c
@@ -133,6 +133,8 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
{
/* not a loop (only to be able to break out) */
do {
+ /* Allow very small faces to be considered non-zero. */
+ const float eps_zero_area = 1e-12f;
const float area_2x_234 = cross_tri_v2(v2, v3, v4);
const float area_2x_241 = cross_tri_v2(v2, v4, v1);
@@ -143,7 +145,6 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
(ELEM(v2, v1, v3, v4) == false) &&
(ELEM(v3, v1, v2, v4) == false) &&
(ELEM(v4, v1, v2, v3) == false));
-
/*
* Test for unusable (1-3) state.
* - Area sign flipping to check faces aren't going to point in opposite directions.
@@ -152,7 +153,7 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
if ((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f)) {
break;
}
- else if ((fabsf(area_2x_123) <= FLT_EPSILON) || (fabsf(area_2x_134) <= FLT_EPSILON)) {
+ else if ((fabsf(area_2x_123) <= eps_zero_area) || (fabsf(area_2x_134) <= eps_zero_area)) {
break;
}
@@ -165,7 +166,7 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
return -FLT_MAX; /* always rotate */
}
}
- else if ((fabsf(area_2x_234) <= FLT_EPSILON) || (fabsf(area_2x_241) <= FLT_EPSILON)) {
+ else if ((fabsf(area_2x_234) <= eps_zero_area) || (fabsf(area_2x_241) <= eps_zero_area)) {
return -FLT_MAX; /* always rotate */
}
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c
index 78e3e66b70a..6e6242fc9f9 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.c
+++ b/source/blender/bmesh/tools/bmesh_beautify.c
@@ -150,7 +150,7 @@ static float bm_edge_calc_rotate_beauty__area(
(ELEM(v4, v1, v2, v3) == false));
add_v3_v3v3(no, no_a, no_b);
- if (UNLIKELY((no_scale = normalize_v3(no)) <= FLT_EPSILON)) {
+ if (UNLIKELY((no_scale = normalize_v3(no)) == 0.0f)) {
break;
}