Skip to content

Commit

Permalink
better sparse rectilinear coverage (began at spacing/2 instead of spa…
Browse files Browse the repository at this point in the history
…cing)
  • Loading branch information
supermerill committed Jul 8, 2019
1 parent bc4f73a commit aa5d17e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/Fill/FillRectilinear2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ std::vector<SegmentedIntersectionLine> 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;

Expand Down
24 changes: 13 additions & 11 deletions src/test/libslic3r/test_fill.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#define CATCH_CONFIG_DISABLE
//#define CATCH_CONFIG_DISABLE

#include <catch.hpp>
#include "../test_data.hpp"
Expand Down Expand Up @@ -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="<<paths.size() << "\n";
{
std::stringstream stri;
stri << "squarewithhole.svg";
SVG svg(stri.str());
svg.draw(paths);
svg.draw(e);
svg.Close();
}
REQUIRE((paths.size() >= 2 && paths.size() <= 3));
//std::cout << "paths.size="<<paths.size() << "\n";
//{
// std::stringstream stri;
// stri << "squarewithhole.svg";
// SVG svg(stri.str());
// svg.draw(paths);
// svg.draw(e);
// svg.Close();
//}
//path CAN loop around the hole
REQUIRE(paths.size() >= 1);
REQUIRE(paths.size() <= 2);
// paths don't cross hole
REQUIRE(diff_pl(paths, offset(e, (float)(+SCALED_EPSILON * 10))).size() == 0);
}
Expand Down

0 comments on commit aa5d17e

Please sign in to comment.