Merge branch 'tm_openvdb_integration' into lm_tm_hollowing
* Refactor file names in SLA dir
This commit is contained in:
commit
c22423a219
55 changed files with 1644 additions and 592 deletions
tests/libslic3r
|
@ -2,7 +2,7 @@
|
|||
#include <fstream>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "libslic3r/OpenVDBUtils.hpp"
|
||||
#include "libslic3r/SLA/Hollowing.hpp"
|
||||
#include <openvdb/tools/Filter.h>
|
||||
#include "libslic3r/Format/OBJ.hpp"
|
||||
|
||||
|
@ -25,36 +25,16 @@ 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");
|
||||
in_mesh.scale(3.);
|
||||
Slic3r::sla::Contour3D imesh = Slic3r::sla::Contour3D{in_mesh};
|
||||
|
||||
Benchmark bench;
|
||||
bench.start();
|
||||
|
||||
openvdb::math::Transform tr;
|
||||
auto ptr = Slic3r::meshToVolume(imesh, {}, 0.0f, 10.0f);
|
||||
|
||||
REQUIRE(ptr);
|
||||
|
||||
openvdb::tools::Filter<openvdb::FloatGrid>{*ptr}.gaussian(1, 3);
|
||||
|
||||
|
||||
double iso_surface = -3.0;
|
||||
double adaptivity = 0.5;
|
||||
Slic3r::sla::Contour3D omesh = Slic3r::volumeToMesh(*ptr, iso_surface, adaptivity);
|
||||
|
||||
REQUIRE(!omesh.empty());
|
||||
|
||||
imesh.merge(omesh);
|
||||
|
||||
for (auto &p : imesh.points) p /= 3.;
|
||||
Slic3r::TriangleMesh out_mesh = Slic3r::sla::generate_interior(in_mesh);
|
||||
|
||||
bench.stop();
|
||||
|
||||
std::cout << "Elapsed processing time: " << bench.getElapsedSec() << std::endl;
|
||||
std::fstream merged_outfile("merged_out.obj", std::ios::out);
|
||||
imesh.to_obj(merged_outfile);
|
||||
|
||||
std::fstream outfile("out.obj", std::ios::out);
|
||||
omesh.to_obj(outfile);
|
||||
in_mesh.merge(out_mesh);
|
||||
in_mesh.require_shared_vertices();
|
||||
in_mesh.WriteOBJFile("merged_out.obj");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue