2020-06-25 11:58:51 +00:00
|
|
|
//#include <catch2/catch.hpp>
|
|
|
|
//#include <test_utils.hpp>
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
//#include "libslic3r/TriangleMesh.hpp"
|
|
|
|
//#include "libslic3r/SLA/SupportTreeBuildsteps.hpp"
|
|
|
|
//#include "libslic3r/SLA/SupportTreeMesher.hpp"
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
//TEST_CASE("Test bridge_mesh_intersect on a cube's wall", "[SLABridgeMeshInters]") {
|
|
|
|
// using namespace Slic3r;
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// TriangleMesh cube = make_cube(10., 10., 10.);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// 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};
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// size_t steps = 45;
|
|
|
|
// SECTION("Bridge is straight horizontal and pointing away from the cube") {
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 5.},
|
|
|
|
// pts[0].head_front_radius);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// auto hit = sla::query_hit(sm, bridge);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// REQUIRE(std::isinf(hit.distance()));
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// cube.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
|
|
|
// cube.require_shared_vertices();
|
|
|
|
// cube.WriteOBJFile("cube1.obj");
|
|
|
|
// }
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// 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);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// auto hit = sla::query_hit(sm, bridge);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// REQUIRE(std::isinf(hit.distance()));
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// cube.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
|
|
|
// cube.require_shared_vertices();
|
|
|
|
// cube.WriteOBJFile("cube2.obj");
|
|
|
|
// }
|
|
|
|
//}
|
2020-06-02 15:31:52 +00:00
|
|
|
|
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
//TEST_CASE("Test bridge_mesh_intersect on a sphere", "[SLABridgeMeshInters]") {
|
|
|
|
// using namespace Slic3r;
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// TriangleMesh sphere = make_sphere(1.);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// 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};
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// size_t steps = 45;
|
|
|
|
// SECTION("Bridge is straight horizontal and pointing away from the sphere") {
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., 0.},
|
|
|
|
// pts[0].head_front_radius);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// auto hit = sla::query_hit(sm, bridge);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
|
|
|
// sphere.require_shared_vertices();
|
|
|
|
// sphere.WriteOBJFile("sphere1.obj");
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// REQUIRE(std::isinf(hit.distance()));
|
|
|
|
// }
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// SECTION("Bridge is tilted down 45 deg and pointing away from the sphere") {
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., -2.},
|
|
|
|
// pts[0].head_front_radius);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// auto hit = sla::query_hit(sm, bridge);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
|
|
|
// sphere.require_shared_vertices();
|
|
|
|
// sphere.WriteOBJFile("sphere2.obj");
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// REQUIRE(std::isinf(hit.distance()));
|
|
|
|
// }
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// SECTION("Bridge is tilted down 90 deg and pointing away from the sphere") {
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{1., 0., -2.},
|
|
|
|
// pts[0].head_front_radius);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// auto hit = sla::query_hit(sm, bridge);
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
|
|
|
// sphere.require_shared_vertices();
|
|
|
|
// sphere.WriteOBJFile("sphere3.obj");
|
2020-06-02 15:31:52 +00:00
|
|
|
|
2020-06-25 11:58:51 +00:00
|
|
|
// REQUIRE(std::isinf(hit.distance()));
|
|
|
|
// }
|
|
|
|
//}
|