diff --git a/src/libslic3r/Fill/FillRectilinear2.cpp b/src/libslic3r/Fill/FillRectilinear2.cpp index 8beff03be..c073968f2 100644 --- a/src/libslic3r/Fill/FillRectilinear2.cpp +++ b/src/libslic3r/Fill/FillRectilinear2.cpp @@ -767,7 +767,7 @@ std::vector FillRectilinear2::_vert_lines_for_polygon { // n_vlines = ceil(bbox_width / line_spacing) size_t n_vlines = (bounding_box.max(0) - bounding_box.min(0) + line_spacing - 1) / line_spacing; - coord_t x0 = bounding_box.min(0); + coord_t x0 = bounding_box.min(0) + (bounding_box.max(0) - bounding_box.min(0) + line_spacing - n_vlines*line_spacing) / 2; if (params.full_infill()) x0 += (line_spacing + SCALED_EPSILON) / 2; diff --git a/src/test/libslic3r/test_fill.cpp b/src/test/libslic3r/test_fill.cpp index 8218ec029..eafb58258 100644 --- a/src/test/libslic3r/test_fill.cpp +++ b/src/test/libslic3r/test_fill.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include "../test_data.hpp" @@ -91,16 +91,18 @@ TEST_CASE("Fill: Pattern Path Length") { e.contour = Slic3r::Polygon(test_square); e.holes = Slic3r::Polygons(Slic3r::Polygon(test_hole)); Polylines paths {test(e, *filler, params_local)}; - std::cout << "paths.size="<= 2 && paths.size() <= 3)); + //std::cout << "paths.size="<= 1); + REQUIRE(paths.size() <= 2); // paths don't cross hole REQUIRE(diff_pl(paths, offset(e, (float)(+SCALED_EPSILON * 10))).size() == 0); }