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

github.com/prusa3d/PrusaSlicer.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-01-09 18:57:11 +0300
committertamasmeszaros <meszaros.q@gmail.com>2020-01-09 18:57:11 +0300
commit7ac0e0a8c9195b111025399743a8c5f3ca6a3796 (patch)
treec1cea694a0b8f218a5d842c2790014a6e554b504 /tests
parentf22961edaed244337f463fefad1634a0883c727f (diff)
more raycaster tests, without repeating the hollowing every time
Diffstat (limited to 'tests')
-rw-r--r--tests/sla_print/sla_raycast_tests.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/tests/sla_print/sla_raycast_tests.cpp b/tests/sla_print/sla_raycast_tests.cpp
index c60f4c8ee..4a994f2a9 100644
--- a/tests/sla_print/sla_raycast_tests.cpp
+++ b/tests/sla_print/sla_raycast_tests.cpp
@@ -37,24 +37,28 @@ TEST_CASE("Raycaster with loaded drillholes", "[sla_raycast]")
emesh.load_holes(holes);
Vec3d s = center.cast<double>();
- SECTION("Fire from center, should hit the interior wall") {
- auto hit = emesh.query_ray_hit(s, {0, 1., 0.});
- REQUIRE(hit.distance() == Approx(boxbb.size().x() / 2 - hcfg.min_thickness));
- }
+ // Fire from center, should hit the interior wall
+ auto hit = emesh.query_ray_hit(s, {0, 1., 0.});
+ REQUIRE(hit.distance() == Approx(boxbb.size().x() / 2 - hcfg.min_thickness));
- SECTION("Fire upward from hole center, hit distance equals the radius") {
- s.y() = hcfg.min_thickness / 2;
- auto hit = emesh.query_ray_hit(s, {0, 0., 1.});
- REQUIRE(hit.distance() == Approx(radius));
- }
-
- SECTION("Fire from outside, hit the back side of the hole cylinder.") {
- s.y() = -1.;
- auto hit = emesh.query_ray_hit(s, {0, 1., 0.});
- REQUIRE(hit.distance() == Approx(boxbb.size().y() - hcfg.min_thickness + 1.));
- }
+ // Fire upward from hole center, hit distance equals the radius (hits the
+ // side of the hole cut.
+ s.y() = hcfg.min_thickness / 2;
+ hit = emesh.query_ray_hit(s, {0, 0., 1.});
+ REQUIRE(hit.distance() == Approx(radius));
+
+ // Fire from outside, hit the back side of the cube interior
+ s.y() = -1.;
+ hit = emesh.query_ray_hit(s, {0, 1., 0.});
+ REQUIRE(hit.distance() == Approx(boxbb.max.y() - hcfg.min_thickness - s.y()));
- SECTION("Check for support tree correctness") {
- test_support_model_collision("20mm_cube.obj", {}, hcfg, holes);
- }
+ // Fire downwards from above the hole cylinder. Has to go through the cyl.
+ // as it was not there.
+ s = center.cast<double>();
+ s.z() = boxbb.max.z() - hcfg.min_thickness - 1.;
+ hit = emesh.query_ray_hit(s, {0, 0., -1.});
+ REQUIRE(hit.distance() == Approx(s.z() - boxbb.min.z() - hcfg.min_thickness));
+
+ // Check for support tree correctness
+ test_support_model_collision("20mm_cube.obj", {}, hcfg, holes);
}