Merge branch 'vb_treesupports'

This commit is contained in:
Vojtech Bubnik 2022-08-23 16:45:34 +02:00
commit 3f69643516
41 changed files with 5999 additions and 720 deletions

View file

@ -22,6 +22,7 @@ add_executable(${_TEST_NAME}_tests
test_meshboolean.cpp
test_marchingsquares.cpp
test_timeutils.cpp
test_utils.cpp
test_voronoi.cpp
test_optimizers.cpp
test_png_io.cpp

View file

@ -294,7 +294,7 @@ SCENARIO("Various Clipper operations - t/clipper.t", "[ClipperUtils]") {
WHEN("clipping a line") {
auto line = Polyline::new_scale({ { 152.742,288.086671142818 }, { 152.742,34.166466971035 } });
Polylines intersection = intersection_pl(line, Polygons{ circle_with_hole });
Polylines intersection = intersection_pl(line, to_polygons(circle_with_hole));
THEN("clipped to two pieces") {
REQUIRE(intersection.front().length() == Approx((Vec2d(152742000, 215178843) - Vec2d(152742000, 288086661)).norm()));
REQUIRE(intersection[1].length() == Approx((Vec2d(152742000, 35166477) - Vec2d(152742000, 108087507)).norm()));

View file

@ -0,0 +1,35 @@
#include <catch2/catch.hpp>
#include "libslic3r/libslic3r.h"
SCENARIO("Test fast_round_up()") {
using namespace Slic3r;
THEN("fast_round_up<int>(1.5) is 2") {
REQUIRE(fast_round_up<int>(1.5) == 2);
}
THEN("fast_round_up<int>(1.499999999999999) is 1") {
REQUIRE(fast_round_up<int>(1.499999999999999) == 1);
}
THEN("fast_round_up<int>(0.5) is 1") {
REQUIRE(fast_round_up<int>(0.5) == 1);
}
THEN("fast_round_up<int>(0.49999999999999994) is 0") {
REQUIRE(fast_round_up<int>(0.49999999999999994) == 0);
}
THEN("fast_round_up<int>(-0.5) is 0") {
REQUIRE(fast_round_up<int>(-0.5) == 0);
}
THEN("fast_round_up<int>(-0.51) is -1") {
REQUIRE(fast_round_up<int>(-0.51) == -1);
}
THEN("fast_round_up<int>(-0.51) is -1") {
REQUIRE(fast_round_up<int>(-0.51) == -1);
}
THEN("fast_round_up<int>(-1.5) is -1") {
REQUIRE(fast_round_up<int>(-1.5) == -1);
}
THEN("fast_round_up<int>(-1.51) is -2") {
REQUIRE(fast_round_up<int>(-1.51) == -2);
}
}