From a2de09e11e03a23be5056b2a5d0e9dfaa386a3c5 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Wed, 5 May 2021 13:19:01 +0200 Subject: [PATCH] Fixing unit tests. --- src/libslic3r/Fill/FillPlanePath.cpp | 14 ++++++-------- tests/fff_print/test_fill.cpp | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/Fill/FillPlanePath.cpp b/src/libslic3r/Fill/FillPlanePath.cpp index 6385a880e..f1e3884bc 100644 --- a/src/libslic3r/Fill/FillPlanePath.cpp +++ b/src/libslic3r/Fill/FillPlanePath.cpp @@ -33,18 +33,16 @@ void FillPlanePath::_fill_surface_single( coord_t(ceil(coordf_t(bounding_box.max.x()) / distance_between_lines)), coord_t(ceil(coordf_t(bounding_box.max.y()) / distance_between_lines))); - Polylines polylines; if (pts.size() >= 2) { // Convert points to a polyline, upscale. - polylines.push_back(Polyline()); - Polyline &polyline = polylines.back(); + Polylines polylines(1, Polyline()); + Polyline &polyline = polylines.front(); polyline.points.reserve(pts.size()); for (const Vec2d &pt : pts) - polyline.points.push_back(Point( - coord_t(floor(pt.x() * distance_between_lines + 0.5)), - coord_t(floor(pt.y() * distance_between_lines + 0.5)))); -// intersection(polylines_src, offset((Polygons)expolygon, scale_(0.02)), &polylines); - polylines = intersection_pl(std::move(polylines), expolygon); + polyline.points.emplace_back( + coord_t(floor(pt.x() * distance_between_lines + 0.5)), + coord_t(floor(pt.y() * distance_between_lines + 0.5))); + polylines = intersection_pl(polylines, expolygon); Polylines chained; if (params.dont_connect() || params.density > 0.5 || polylines.size() <= 1) chained = chain_polylines(std::move(polylines)); diff --git a/tests/fff_print/test_fill.cpp b/tests/fff_print/test_fill.cpp index 222e94d99..8e311282e 100644 --- a/tests/fff_print/test_fill.cpp +++ b/tests/fff_print/test_fill.cpp @@ -456,7 +456,7 @@ bool test_if_solid_surface_filled(const ExPolygon& expolygon, double flow_spacin }); // Shrink the initial expolygon a bit, this simulates the infill / perimeter overlap that we usually apply. - ExPolygons uncovered = diff_ex(offset(expolygon, - float(0.2 * scale_(flow_spacing))), grown_paths, true); + ExPolygons uncovered = diff_ex(offset(expolygon, - float(0.2 * scale_(flow_spacing))), grown_paths, ApplySafetyOffset::Yes); // ignore very small dots const double scaled_flow_spacing = std::pow(scale_(flow_spacing), 2);