Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2020-06-02 18:31:52 +0300
committertamasmeszaros <meszaros.q@gmail.com>2020-08-03 20:05:30 +0300
commit06223221466508358ee210161b5872dae2f883e0 (patch)
tree8aa30068e4026d67387e943110979657f08fd2a9 /tests
parent38239f09e3ea889aab14cc6c6bc2d6a27013981d (diff)
Create smaller supports in problematic areas with established strategies
Completely remove the concept of CompactBridge. Replace it with Heads having the same back radius as front radius. Try to apply the same rules for mini supports as in the route_to_model step. Increased accuracy of bridge_mesh_intersect shot from support points Refining mini support integration
Diffstat (limited to 'tests')
-rw-r--r--tests/sla_print/CMakeLists.txt2
-rw-r--r--tests/sla_print/sla_test_utils.cpp6
-rw-r--r--tests/sla_print/sla_treebuilder_tests.cpp96
3 files changed, 100 insertions, 4 deletions
diff --git a/tests/sla_print/CMakeLists.txt b/tests/sla_print/CMakeLists.txt
index 9d47f3ae4..f6b261fda 100644
--- a/tests/sla_print/CMakeLists.txt
+++ b/tests/sla_print/CMakeLists.txt
@@ -1,7 +1,7 @@
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp
sla_print_tests.cpp
- sla_test_utils.hpp sla_test_utils.cpp
+ sla_test_utils.hpp sla_test_utils.cpp sla_treebuilder_tests.cpp
sla_raycast_tests.cpp)
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
diff --git a/tests/sla_print/sla_test_utils.cpp b/tests/sla_print/sla_test_utils.cpp
index 1eaf796c0..5a3bd82a0 100644
--- a/tests/sla_print/sla_test_utils.cpp
+++ b/tests/sla_print/sla_test_utils.cpp
@@ -129,8 +129,7 @@ void test_supports(const std::string &obj_filename,
// If there is no elevation, support points shall be removed from the
// bottom of the object.
if (std::abs(supportcfg.object_elevation_mm) < EPSILON) {
- sla::remove_bottom_points(support_points, zmin,
- supportcfg.base_height_mm);
+ sla::remove_bottom_points(support_points, zmin + supportcfg.base_height_mm);
} else {
// Should be support points at least on the bottom of the model
REQUIRE_FALSE(support_points.empty());
@@ -141,7 +140,8 @@ void test_supports(const std::string &obj_filename,
// Generate the actual support tree
sla::SupportTreeBuilder treebuilder;
- treebuilder.build(sla::SupportableMesh{emesh, support_points, supportcfg});
+ sla::SupportableMesh sm{emesh, support_points, supportcfg};
+ sla::SupportTreeBuildsteps::execute(treebuilder, sm);
check_support_tree_integrity(treebuilder, supportcfg);
diff --git a/tests/sla_print/sla_treebuilder_tests.cpp b/tests/sla_print/sla_treebuilder_tests.cpp
new file mode 100644
index 000000000..c785e4ba5
--- /dev/null
+++ b/tests/sla_print/sla_treebuilder_tests.cpp
@@ -0,0 +1,96 @@
+#include <catch2/catch.hpp>
+#include <test_utils.hpp>
+
+#include "libslic3r/TriangleMesh.hpp"
+#include "libslic3r/SLA/SupportTreeBuilder.hpp"
+
+TEST_CASE("Test bridge_mesh_intersect on a cube's wall", "[SLABridgeMeshInters]") {
+ using namespace Slic3r;
+
+ TriangleMesh cube = make_cube(10., 10., 10.);
+
+ sla::SupportConfig cfg = {}; // use default config
+ sla::SupportPoints pts = {{10.f, 5.f, 5.f, float(cfg.head_front_radius_mm), false}};
+ sla::SupportableMesh sm{cube, pts, cfg};
+
+ SECTION("Bridge is straight horizontal and pointing away from the cube") {
+
+ sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 5.},
+ pts[0].head_front_radius);
+
+ auto hit = sla::query_hit(sm, bridge);
+
+ REQUIRE(std::isinf(hit.distance()));
+
+ cube.merge(sla::to_triangle_mesh(bridge.mesh));
+ cube.require_shared_vertices();
+ cube.WriteOBJFile("cube1.obj");
+ }
+
+ SECTION("Bridge is tilted down in 45 degrees, pointing away from the cube") {
+ sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 0.},
+ pts[0].head_front_radius);
+
+ auto hit = sla::query_hit(sm, bridge);
+
+ REQUIRE(std::isinf(hit.distance()));
+
+ cube.merge(sla::to_triangle_mesh(bridge.mesh));
+ cube.require_shared_vertices();
+ cube.WriteOBJFile("cube2.obj");
+ }
+}
+
+
+TEST_CASE("Test bridge_mesh_intersect on a sphere", "[SLABridgeMeshInters]") {
+ using namespace Slic3r;
+
+ TriangleMesh sphere = make_sphere(1.);
+
+ sla::SupportConfig cfg = {}; // use default config
+ cfg.head_back_radius_mm = cfg.head_front_radius_mm;
+ sla::SupportPoints pts = {{1.f, 0.f, 0.f, float(cfg.head_front_radius_mm), false}};
+ sla::SupportableMesh sm{sphere, pts, cfg};
+
+ SECTION("Bridge is straight horizontal and pointing away from the sphere") {
+
+ sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., 0.},
+ pts[0].head_front_radius);
+
+ auto hit = sla::query_hit(sm, bridge);
+
+ sphere.merge(sla::to_triangle_mesh(bridge.mesh));
+ sphere.require_shared_vertices();
+ sphere.WriteOBJFile("sphere1.obj");
+
+ REQUIRE(std::isinf(hit.distance()));
+ }
+
+ SECTION("Bridge is tilted down 45 deg and pointing away from the sphere") {
+
+ sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., -2.},
+ pts[0].head_front_radius);
+
+ auto hit = sla::query_hit(sm, bridge);
+
+ sphere.merge(sla::to_triangle_mesh(bridge.mesh));
+ sphere.require_shared_vertices();
+ sphere.WriteOBJFile("sphere2.obj");
+
+ REQUIRE(std::isinf(hit.distance()));
+ }
+
+ SECTION("Bridge is tilted down 90 deg and pointing away from the sphere") {
+
+ sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{1., 0., -2.},
+ pts[0].head_front_radius);
+
+ auto hit = sla::query_hit(sm, bridge);
+
+ sphere.merge(sla::to_triangle_mesh(bridge.mesh));
+ sphere.require_shared_vertices();
+ sphere.WriteOBJFile("sphere3.obj");
+
+ REQUIRE(std::isinf(hit.distance()));
+ }
+}