Fix T52834: Polyfill2D fails with co-linear edges
authorCampbell Barton <ideasman42@gmail.com>
Tue, 19 Sep 2017 18:29:04 +0000 (04:29 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 19 Sep 2017 18:29:04 +0000 (04:29 +1000)
source/blender/blenlib/intern/polyfill2d.c
tests/gtests/blenlib/BLI_polyfill2d_test.cc

index 5f9b92198a57bdede109cf7265e7ca03198bb9c7..26f8709b16e488036b542d8e0d6b22ba060b95e4 100644 (file)
@@ -411,11 +411,11 @@ static bool kdtree2d_isect_tri_recursive(
        }
 
 #define KDTREE2D_ISECT_TRI_RECURSE_NEG \
-       (((node->neg != KDNODE_UNSET) && (co[node->axis] > bounds[node->axis].min)) &&   \
+       (((node->neg != KDNODE_UNSET) && (co[node->axis] >= bounds[node->axis].min)) &&  \
          (kdtree2d_isect_tri_recursive(tree, tri_index, tri_coords, tri_center, bounds, \
                                        &tree->nodes[node->neg])))
 #define KDTREE2D_ISECT_TRI_RECURSE_POS \
-       (((node->pos != KDNODE_UNSET) && (co[node->axis] < bounds[node->axis].max)) &&   \
+       (((node->pos != KDNODE_UNSET) && (co[node->axis] <= bounds[node->axis].max)) &&  \
          (kdtree2d_isect_tri_recursive(tree, tri_index, tri_coords, tri_center, bounds, \
                                        &tree->nodes[node->pos])))
 
index 5f10837fca1927f9ab5b82beb3eccc1450ab90db..ca3a67bd0a795a7f12ec842e2e959c811db49678 100644 (file)
@@ -540,7 +540,6 @@ TEST(polyfill2d, IssueT41986_axis_align)
        TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
 }
 
-#if 0
 /* Blender bug T52834 */
 TEST(polyfill2d, IssueT52834_axis_align_co_linear)
 {
@@ -554,5 +553,3 @@ TEST(polyfill2d, IssueT52834_axis_align_co_linear)
 
        TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
 }
-#endif
-