Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVojtech Bubnik <bubnikv@gmail.com>2021-05-17 21:25:59 +0300
committerVojtech Bubnik <bubnikv@gmail.com>2021-05-17 21:25:59 +0300
commit308d6b78096ac7b53b4698d9c6bc698fa434282e (patch)
tree67dec9e77af072682e73a5a364583cab54da4d37 /tests
parent68d2427a347d0d8b0df0f42465289f1b662e23b1 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/fff_print/test_trianglemesh.cpp1
-rw-r--r--tests/libslic3r/test_marchingsquares.cpp3
-rw-r--r--tests/sla_print/sla_print_tests.cpp7
-rw-r--r--tests/sla_print/sla_test_utils.cpp7
4 files changed, 9 insertions, 9 deletions
diff --git a/tests/fff_print/test_trianglemesh.cpp b/tests/fff_print/test_trianglemesh.cpp
index 233b0e515..a066215c2 100644
--- a/tests/fff_print/test_trianglemesh.cpp
+++ b/tests/fff_print/test_trianglemesh.cpp
@@ -1,6 +1,7 @@
#include <catch2/catch.hpp>
#include "libslic3r/TriangleMesh.hpp"
+#include "libslic3r/TriangleMeshSlicer.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/Model.hpp"
diff --git a/tests/libslic3r/test_marchingsquares.cpp b/tests/libslic3r/test_marchingsquares.cpp
index 1a4b1fb72..66a0060fe 100644
--- a/tests/libslic3r/test_marchingsquares.cpp
+++ b/tests/libslic3r/test_marchingsquares.cpp
@@ -13,6 +13,7 @@
#include <libslic3r/SVG.hpp>
#include <libslic3r/ClipperUtils.hpp>
+#include <libslic3r/TriangleMeshSlicer.hpp>
#include <libslic3r/TriangulateWall.hpp>
#include <libslic3r/Tesselate.hpp>
#include <libslic3r/SlicesToTriangleMesh.hpp>
@@ -320,7 +321,7 @@ static void recreate_object_from_rasters(const std::string &objname, float lh) {
bb = mesh.bounding_box();
std::vector<ExPolygons> layers;
- slice_mesh(mesh, grid(float(bb.min.z()) + lh, float(bb.max.z()), lh), layers, 0.f, []{});
+ slice_mesh(mesh, grid(float(bb.min.z()) + lh, float(bb.max.z()), lh), layers);
sla::RasterBase::Resolution res{2560, 1440};
double disp_w = 120.96;
diff --git a/tests/sla_print/sla_print_tests.cpp b/tests/sla_print/sla_print_tests.cpp
index 1f98463cc..75748dd34 100644
--- a/tests/sla_print/sla_print_tests.cpp
+++ b/tests/sla_print/sla_print_tests.cpp
@@ -6,6 +6,7 @@
#include "sla_test_utils.hpp"
+#include <libslic3r/TriangleMeshSlicer.hpp>
#include <libslic3r/SLA/SupportTreeMesher.hpp>
#include <libslic3r/SLA/Concurrency.hpp>
@@ -48,9 +49,7 @@ TEST_CASE("Support point generator should be deterministic if seeded",
sla::SupportPointGenerator::Config autogencfg;
autogencfg.head_diameter = float(2 * supportcfg.head_front_radius_mm);
sla::SupportPointGenerator point_gen{emesh, autogencfg, [] {}, [](int) {}};
-
- TriangleMeshSlicer slicer{&mesh};
-
+
auto bb = mesh.bounding_box();
double zmin = bb.min.z();
double zmax = bb.max.z();
@@ -59,7 +58,7 @@ TEST_CASE("Support point generator should be deterministic if seeded",
auto slicegrid = grid(float(gnd), float(zmax), layer_h);
std::vector<ExPolygons> slices;
- slicer.slice(slicegrid, SlicingMode::Regular, CLOSING_RADIUS, &slices, []{});
+ slice_mesh(mesh, slicegrid, CLOSING_RADIUS, slices);
point_gen.seed(0);
point_gen.execute(slices, slicegrid);
diff --git a/tests/sla_print/sla_test_utils.cpp b/tests/sla_print/sla_test_utils.cpp
index 1ec890beb..fdf77466b 100644
--- a/tests/sla_print/sla_test_utils.cpp
+++ b/tests/sla_print/sla_test_utils.cpp
@@ -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};