Use number_of_parts for is_splittable
It's there, why not use it
This commit is contained in:
parent
4a9e05194c
commit
cd3cec3e45
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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<bool> 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.
|
||||
|
@ -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<uint32_t> find_unvisited_neighbors(std::vector<bool> &facet_visited) const;
|
||||
|
||||
stl_file stl;
|
||||
|
Loading…
Reference in New Issue
Block a user