diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index b5b9a008d..a9835eaa1 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -1467,11 +1467,7 @@ int ModelVolume::extruder_id() const bool ModelVolume::is_splittable() const { - // the call mesh.is_splittable() is expensive, so cache the value to calculate it only once - if (m_is_splittable == -1) - m_is_splittable = (int)mesh.is_splittable(); - - return m_is_splittable == 1; + return mesh.stl.stats.number_of_parts > 1; } void ModelVolume::center_geometry() diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index 8a48f8ee9..919e7715c 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -420,12 +420,6 @@ private: TriangleMesh m_convex_hull; Geometry::Transformation m_transformation; - // flag to optimize the checking if the volume is splittable - // -1 -> is unknown value (before first cheking) - // 0 -> is not splittable - // 1 -> is splittable - mutable int m_is_splittable{ -1 }; - ModelVolume(ModelObject *object, const TriangleMesh &mesh) : mesh(mesh), m_type(ModelVolumeType::MODEL_PART), object(object) { if (mesh.stl.stats.number_of_facets > 1) diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp index 759568860..1baf3cee3 100644 --- a/src/libslic3r/TriangleMesh.cpp +++ b/src/libslic3r/TriangleMesh.cpp @@ -338,19 +338,6 @@ void TriangleMesh::rotate(double angle, Point* center) this->translate(c(0), c(1), 0); } -/** - * Calculates whether or not the mesh is splittable. - */ -bool TriangleMesh::is_splittable() const -{ - std::vector visited; - find_unvisited_neighbors(visited); - - // Try finding an unvisited facet. If there are none, the mesh is not splittable. - auto it = std::find(visited.begin(), visited.end(), false); - return it != visited.end(); -} - /** * Visit all unvisited neighboring facets that are reachable from the first unvisited facet, * and return them. diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index b204a9a3e..e538b7693 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -68,7 +68,6 @@ public: size_t facets_count() const { return this->stl.stats.number_of_facets; } bool empty() const { return this->facets_count() == 0; } - bool is_splittable() const; std::deque find_unvisited_neighbors(std::vector &facet_visited) const; stl_file stl;