Files
OrcaSlicer-bambulab/tests/libslic3r/test_hollowing.cpp
T

52 lines
1.2 KiB
C++
Raw Normal View History

2019-10-29 16:27:53 +01:00
#include <iostream>
2019-10-31 14:36:33 +01:00
#include <fstream>
#include <catch2/catch.hpp>
2019-10-29 16:27:53 +01:00
#include "libslic3r/OpenVDBUtils.hpp"
2019-10-29 16:27:53 +01:00
#include "libslic3r/Format/OBJ.hpp"
#if defined(WIN32) || defined(_WIN32)
#define PATH_SEPARATOR R"(\)"
#else
#define PATH_SEPARATOR R"(/)"
#endif
static Slic3r::TriangleMesh load_model(const std::string &obj_filename)
{
Slic3r::TriangleMesh mesh;
auto fpath = TEST_DATA_DIR PATH_SEPARATOR + obj_filename;
Slic3r::load_obj(fpath.c_str(), &mesh);
return mesh;
}
static bool _check_normals(const Slic3r::sla::Contour3D &mesh)
{
for (auto & face : mesh.faces3)
{
}
2019-10-31 14:36:33 +01:00
return false;
}
TEST_CASE("Negative 3D offset should produce smaller object.", "[Hollowing]")
{
Slic3r::sla::Contour3D imesh = Slic3r::sla::Contour3D{load_model("20mm_cube.obj")};
2019-10-31 14:36:33 +01:00
auto ptr = Slic3r::meshToVolume(imesh, {});
2019-10-29 16:27:53 +01:00
2019-10-30 12:38:23 +01:00
REQUIRE(ptr);
2019-10-31 14:36:33 +01:00
Slic3r::sla::Contour3D omesh = Slic3r::volumeToMesh(*ptr, -1., 0.0, true);
2019-10-30 12:38:23 +01:00
2019-10-31 14:36:33 +01:00
REQUIRE(!omesh.empty());
2019-10-30 12:38:23 +01:00
2019-10-31 14:36:33 +01:00
std::fstream outfile{"out.obj", std::ios::out};
omesh.to_obj(outfile);
imesh.merge(omesh);
std::fstream merged_outfile("merged_out.obj", std::ios::out);
imesh.to_obj(merged_outfile);
2019-10-29 16:27:53 +01:00
}