WIP: Reworked slicing

1) Slicing code moved to TriangleMeshSlicer.cpp,hpp from TriangleMesh.cpp,hpp
2) Refactored to use as little as possible of admesh.
This commit is contained in:
Vojtech Bubnik 2021-05-17 20:25:59 +02:00
parent 68d2427a34
commit 308d6b7809
24 changed files with 1828 additions and 1594 deletions

View file

@ -1,4 +1,5 @@
#include "sla_test_utils.hpp"
#include "libslic3r/TriangleMeshSlicer.hpp"
#include "libslic3r/SLA/AGGRaster.hpp"
void test_support_model_collision(const std::string &obj_filename,
@ -94,8 +95,6 @@ void test_supports(const std::string &obj_filename,
mesh.require_shared_vertices();
}
TriangleMeshSlicer slicer{&mesh};
auto bb = mesh.bounding_box();
double zmin = bb.min.z();
double zmax = bb.max.z();
@ -103,7 +102,7 @@ void test_supports(const std::string &obj_filename,
auto layer_h = 0.05f;
out.slicegrid = grid(float(gnd), float(zmax), layer_h);
slicer.slice(out.slicegrid, SlicingMode::Regular, CLOSING_RADIUS, &out.model_slices, []{});
slice_mesh(mesh, out.slicegrid, CLOSING_RADIUS, out.model_slices);
sla::cut_drainholes(out.model_slices, out.slicegrid, CLOSING_RADIUS, drainholes, []{});
// Create the special index-triangle mesh with spatial indexing which
@ -470,7 +469,7 @@ sla::SupportPoints calc_support_pts(
std::vector<ExPolygons> slices;
auto bb = cast<float>(mesh.bounding_box());
std::vector<float> heights = grid(bb.min.z(), bb.max.z(), 0.1f);
slice_mesh(mesh, heights, slices, CLOSING_RADIUS, [] {});
slice_mesh(mesh, heights, CLOSING_RADIUS, slices);
// Prepare the support point calculator
sla::IndexedMesh emesh{mesh};