mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-15 02:51:49 +08:00
better sparse rectilinear coverage (began at spacing/2 instead of spacing)
This commit is contained in:
parent
bc4f73a7e8
commit
aa5d17eff4
@ -767,7 +767,7 @@ std::vector<SegmentedIntersectionLine> FillRectilinear2::_vert_lines_for_polygon
|
|||||||
{
|
{
|
||||||
// n_vlines = ceil(bbox_width / line_spacing)
|
// n_vlines = ceil(bbox_width / line_spacing)
|
||||||
size_t n_vlines = (bounding_box.max(0) - bounding_box.min(0) + line_spacing - 1) / 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())
|
if (params.full_infill())
|
||||||
x0 += (line_spacing + SCALED_EPSILON) / 2;
|
x0 += (line_spacing + SCALED_EPSILON) / 2;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#define CATCH_CONFIG_DISABLE
|
//#define CATCH_CONFIG_DISABLE
|
||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
#include "../test_data.hpp"
|
#include "../test_data.hpp"
|
||||||
@ -91,16 +91,18 @@ TEST_CASE("Fill: Pattern Path Length") {
|
|||||||
e.contour = Slic3r::Polygon(test_square);
|
e.contour = Slic3r::Polygon(test_square);
|
||||||
e.holes = Slic3r::Polygons(Slic3r::Polygon(test_hole));
|
e.holes = Slic3r::Polygons(Slic3r::Polygon(test_hole));
|
||||||
Polylines paths {test(e, *filler, params_local)};
|
Polylines paths {test(e, *filler, params_local)};
|
||||||
std::cout << "paths.size="<<paths.size() << "\n";
|
//std::cout << "paths.size="<<paths.size() << "\n";
|
||||||
{
|
//{
|
||||||
std::stringstream stri;
|
// std::stringstream stri;
|
||||||
stri << "squarewithhole.svg";
|
// stri << "squarewithhole.svg";
|
||||||
SVG svg(stri.str());
|
// SVG svg(stri.str());
|
||||||
svg.draw(paths);
|
// svg.draw(paths);
|
||||||
svg.draw(e);
|
// svg.draw(e);
|
||||||
svg.Close();
|
// svg.Close();
|
||||||
}
|
//}
|
||||||
REQUIRE((paths.size() >= 2 && paths.size() <= 3));
|
//path CAN loop around the hole
|
||||||
|
REQUIRE(paths.size() >= 1);
|
||||||
|
REQUIRE(paths.size() <= 2);
|
||||||
// paths don't cross hole
|
// paths don't cross hole
|
||||||
REQUIRE(diff_pl(paths, offset(e, (float)(+SCALED_EPSILON * 10))).size() == 0);
|
REQUIRE(diff_pl(paths, offset(e, (float)(+SCALED_EPSILON * 10))).size() == 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user