diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp index c81f9066e..8648edc52 100644 --- a/src/libslic3r/TriangleMesh.cpp +++ b/src/libslic3r/TriangleMesh.cpp @@ -611,7 +611,7 @@ TriangleMesh TriangleMesh::convex_hull_3d() const return output_mesh; } -std::vector TriangleMesh::slice(const std::vector &z) +std::vector TriangleMesh::slice(const std::vector &z) const { // convert doubles to floats std::vector z_f(z.begin(), z.end()); @@ -905,7 +905,7 @@ void its_collect_mesh_projection_points_above(const indexed_triangle_set &its, c all_pts.reserve(all_pts.size() + its.indices.size() * 3); for (const stl_triangle_vertex_indices &tri : its.indices) { const Vec3f pts[3] = { transform_fn(its.vertices[tri(0)]), transform_fn(its.vertices[tri(1)]), transform_fn(its.vertices[tri(2)]) }; - int iprev = 3; + int iprev = 2; for (int iedge = 0; iedge < 3; ++ iedge) { const Vec3f &p1 = pts[iprev]; const Vec3f &p2 = pts[iedge]; diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index 29a42eab3..49b11465e 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -65,7 +65,7 @@ public: // Returns the convex hull of this TriangleMesh TriangleMesh convex_hull_3d() const; // Slice this mesh at the provided Z levels and return the vector - std::vector slice(const std::vector& z); + std::vector slice(const std::vector& z) const; void reset_repair_stats(); bool needed_repair() const; void require_shared_vertices();