From 329f0b9cf4dc8be2d09413294554515ec7ae891c Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 5 Apr 2017 08:57:37 +0200 Subject: [PATCH] Debugging output and asserts for TriangleMeshSlicer::slice(). --- xs/src/libslic3r/TriangleMesh.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index f58b9f3e1..b7cdacfa4 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -696,6 +696,22 @@ TriangleMeshSlicer::slice(const std::vector &z, std::vector* la } ); BOOST_LOG_TRIVIAL(debug) << "TriangleMeshSlicer::slice finished"; + +#ifdef SLIC3R_DEBUG + { + static int iRun = 0; + for (size_t i = 0; i < z.size(); ++ i) { + Polygons &polygons = (*layers)[i]; + SVG::export_expolygons(debug_out_path("slice_%d_%d.svg", iRun, i).c_str(), union_ex(polygons, true)); + for (Polygon &poly : polygons) { + for (size_t i = 1; i < poly.points.size(); ++ i) + assert(poly.points[i-1] != poly.points[i]); + assert(poly.points.front() != poly.points.back()); + } + } + ++ iRun; + } +#endif } void TriangleMeshSlicer::_slice_do(size_t facet_idx, std::vector* lines, boost::mutex* lines_mutex,