From 514bb23c6ce49cad049f4def313c18277e149d6e Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 5 Dec 2019 13:38:04 +0100 Subject: [PATCH] Add free functions to slice a TriangleMesh --- src/libslic3r/TriangleMesh.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index 9c9f82040..ef935455e 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -198,6 +198,29 @@ private: void make_expolygons(std::vector &lines, const float closing_radius, ExPolygons* slices) const; }; +inline void slice_mesh( + const TriangleMesh & mesh, + const std::vector & z, + std::vector & layers, + TriangleMeshSlicer::throw_on_cancel_callback_type thr = nullptr) +{ + if (mesh.empty()) return; + TriangleMeshSlicer slicer(&mesh); + slicer.slice(z, &layers, thr); +} + +inline void slice_mesh( + const TriangleMesh & mesh, + const std::vector & z, + std::vector & layers, + float closing_radius, + TriangleMeshSlicer::throw_on_cancel_callback_type thr = nullptr) +{ + if (mesh.empty()) return; + TriangleMeshSlicer slicer(&mesh); + slicer.slice(z, closing_radius, &layers, thr); +} + TriangleMesh make_cube(double x, double y, double z); // Generate a TriangleMesh of a cylinder