Group hollowing result (including grid) into one struct

This commit is contained in:
tamasmeszaros 2020-12-17 16:38:04 +01:00
parent e57eca0289
commit 82954ba715
7 changed files with 133 additions and 67 deletions

View file

@ -26,21 +26,19 @@ static Slic3r::TriangleMesh load_model(const std::string &obj_filename)
}
TEST_CASE("Negative 3D offset should produce smaller object.", "[Hollowing]")
{
Slic3r::TriangleMesh in_mesh = load_model("20mm_cube.obj");
Benchmark bench;
bench.start();
std::unique_ptr<Slic3r::TriangleMesh> out_mesh_ptr =
Slic3r::sla::generate_interior(in_mesh);
bench.stop();
std::cout << "Elapsed processing time: " << bench.getElapsedSec() << std::endl;
if (out_mesh_ptr) in_mesh.merge(*out_mesh_ptr);
in_mesh.require_shared_vertices();
in_mesh.WriteOBJFile("merged_out.obj");
TEST_CASE("Hollow two overlapping spheres") {
using namespace Slic3r;
TriangleMesh sphere1 = make_sphere(10., 2 * PI / 20.), sphere2 = sphere1;
sphere1.translate(-5.f, 0.f, 0.f);
sphere2.translate( 5.f, 0.f, 0.f);
sphere1.merge(sphere2);
sphere1.require_shared_vertices();
sla::hollow_mesh(sphere1, sla::HollowingConfig{}, sla::HollowingFlags::hfRemoveInsideTriangles);
sphere1.WriteOBJFile("twospheres.obj");
}