Merge branch 'tm_openvdb_integration' into lm_tm_hollowing

* Refactor file names in SLA dir
This commit is contained in:
tamasmeszaros 2019-11-11 11:41:14 +01:00
commit c22423a219
55 changed files with 1644 additions and 592 deletions

View file

@ -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");
}

View file

@ -11,11 +11,11 @@
#include "libslic3r/Format/OBJ.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/SLA/SLAPad.hpp"
#include "libslic3r/SLA/SLASupportTreeBuilder.hpp"
#include "libslic3r/SLA/SLASupportTreeBuildsteps.hpp"
#include "libslic3r/SLA/SLAAutoSupports.hpp"
#include "libslic3r/SLA/SLARaster.hpp"
#include "libslic3r/SLA/Pad.hpp"
#include "libslic3r/SLA/SupportTreeBuilder.hpp"
#include "libslic3r/SLA/SupportTreeBuildsteps.hpp"
#include "libslic3r/SLA/SupportPointGenerator.hpp"
#include "libslic3r/SLA/Raster.hpp"
#include "libslic3r/SLA/ConcaveHull.hpp"
#include "libslic3r/MTUtils.hpp"
@ -231,11 +231,12 @@ void test_supports(const std::string & obj_filename,
sla::EigenMesh3D emesh{mesh};
// Create the support point generator
sla::SLAAutoSupports::Config autogencfg;
sla::SupportPointGenerator::Config autogencfg;
autogencfg.head_diameter = float(2 * supportcfg.head_front_radius_mm);
sla::SLAAutoSupports point_gen{emesh, out.model_slices, out.slicegrid,
autogencfg, [] {}, [](int) {}};
sla::SupportPointGenerator point_gen{emesh, out.model_slices,
out.slicegrid, autogencfg,
[] {}, [](int) {}};
// Get the calculated support points.
std::vector<sla::SupportPoint> support_points = point_gen.output();