diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2020-02-14 12:17:55 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2020-02-18 19:39:36 +0300 |
commit | 6deb6a776d38eacf22bd3da78c4546dd5e3a8ccb (patch) | |
tree | 30bd6129f16e175b75969e4514090a85fd64fb6c /tests | |
parent | 41d77b492c26c76c9d34552a0fded919fc57e4bb (diff) |
Do EFC for the first faded layers of SLA, interpolate efc parameters
Compensated slices have negative orientation...
Move efc to common params
Fix elefant foot compensation reversed contours
Remove redundant assertions and don't apply absolute correction if zero
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libslic3r/test_elephant_foot_compensation.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/tests/libslic3r/test_elephant_foot_compensation.cpp b/tests/libslic3r/test_elephant_foot_compensation.cpp index 98ec5df52..616c0c6ad 100644 --- a/tests/libslic3r/test_elephant_foot_compensation.cpp +++ b/tests/libslic3r/test_elephant_foot_compensation.cpp @@ -413,6 +413,19 @@ static ExPolygon contour_with_hole() return out; } +static bool is_valid_orientation(const ExPolygon &p) +{ + bool ret = p.contour.is_counter_clockwise(); + for (auto &h : p.holes) ret = ret && h.is_clockwise(); + return ret; +} + +static bool is_efc_result_smaller(const ExPolygon &efc, const ExPolygon &orig) +{ + double efc_area = efc.area(); + return efc_area > 0. && efc_area < orig.area() && is_valid_orientation(efc); +} + SCENARIO("Elephant foot compensation", "[ElephantFoot]") { GIVEN("Contour with hole") { @@ -426,7 +439,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } @@ -456,7 +469,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } @@ -471,7 +484,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } @@ -523,7 +536,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } WHEN("Fully compensated") { @@ -534,7 +547,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } @@ -549,7 +562,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } @@ -566,7 +579,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } WHEN("Fully compensated") { @@ -577,7 +590,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } WHEN("Brutally compensated") { @@ -588,7 +601,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } @@ -603,7 +616,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") { { { expoly_compensated }, { "gray", "black", "blue", coord_t(scale_(0.02)), 0.5f, "black", coord_t(scale_(0.05)) } } }); #endif /* TESTS_EXPORT_SVGS */ THEN("area of the compensated polygon is smaller") { - REQUIRE(expoly_compensated.area() < expoly.area()); + REQUIRE(is_efc_result_smaller(expoly_compensated, expoly)); } } } |