From 7e780380eee2fb046a44753e3b34501ae1011b36 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Fri, 22 Oct 2021 16:54:21 +0200 Subject: [PATCH] Fix of d43ae66ecaaac762b5ee452e6d500bbb81ccc496 reduced copy / paste redudancy by extracting a new function to produce convex hull: its_convex_hull() --- src/slic3r/GUI/3DScene.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 78e32b1cd0..3dd0c0e1fe 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -622,12 +622,12 @@ void GLVolume::calc_convex_hull_3d() { const std::vector &src = this->indexed_vertex_array.vertices_and_normals_interleaved; std::vector pts; + assert(src.size() % 6 == 0); pts.reserve(src.size() / 6); - for (auto it = src.begin() + 3;;) { + for (auto it = src.begin(); it != src.end(); ) { + it += 3; pts.push_back({ *it, *(it + 1), *(it + 2) }); it += 3; - if (it == src.end()) - break; } this->set_convex_hull(TriangleMesh(its_convex_hull(pts))); }