mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Move repaired check to find_unvisited_neighbors
This commit is contained in:
parent
69199215b0
commit
4a9e05194c
1 changed files with 6 additions and 6 deletions
|
@ -361,6 +361,10 @@ bool TriangleMesh::is_splittable() const
|
||||||
*/
|
*/
|
||||||
std::deque<uint32_t> TriangleMesh::find_unvisited_neighbors(std::vector<bool> &facet_visited) const
|
std::deque<uint32_t> TriangleMesh::find_unvisited_neighbors(std::vector<bool> &facet_visited) const
|
||||||
{
|
{
|
||||||
|
// Make sure we're not operating on a broken mesh.
|
||||||
|
if (!this->repaired)
|
||||||
|
throw std::runtime_error("split() requires repair()");
|
||||||
|
|
||||||
// If the visited list is empty, populate it with false for every facet.
|
// If the visited list is empty, populate it with false for every facet.
|
||||||
if (facet_visited.empty()) {
|
if (facet_visited.empty()) {
|
||||||
facet_visited = std::vector<bool>(this->stl.stats.number_of_facets, false);
|
facet_visited = std::vector<bool>(this->stl.stats.number_of_facets, false);
|
||||||
|
@ -397,10 +401,6 @@ std::deque<uint32_t> TriangleMesh::find_unvisited_neighbors(std::vector<bool> &f
|
||||||
*/
|
*/
|
||||||
TriangleMeshPtrs TriangleMesh::split() const
|
TriangleMeshPtrs TriangleMesh::split() const
|
||||||
{
|
{
|
||||||
// Make sure we're not operating on a broken mesh.
|
|
||||||
if (!this->repaired)
|
|
||||||
throw std::runtime_error("split() requires repair()");
|
|
||||||
|
|
||||||
// Loop while we have remaining facets.
|
// Loop while we have remaining facets.
|
||||||
std::vector<bool> facet_visited;
|
std::vector<bool> facet_visited;
|
||||||
TriangleMeshPtrs meshes;
|
TriangleMeshPtrs meshes;
|
||||||
|
@ -417,7 +417,7 @@ TriangleMeshPtrs TriangleMesh::split() const
|
||||||
mesh->stl.stats.original_num_facets = mesh->stl.stats.number_of_facets;
|
mesh->stl.stats.original_num_facets = mesh->stl.stats.number_of_facets;
|
||||||
stl_clear_error(&mesh->stl);
|
stl_clear_error(&mesh->stl);
|
||||||
stl_allocate(&mesh->stl);
|
stl_allocate(&mesh->stl);
|
||||||
|
|
||||||
// Assign the facets to the new mesh.
|
// Assign the facets to the new mesh.
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto facet = facets.begin(); facet != facets.end(); ++ facet) {
|
for (auto facet = facets.begin(); facet != facets.end(); ++ facet) {
|
||||||
|
@ -425,7 +425,7 @@ TriangleMeshPtrs TriangleMesh::split() const
|
||||||
stl_facet_stats(&mesh->stl, this->stl.facet_start[*facet], first);
|
stl_facet_stats(&mesh->stl, this->stl.facet_start[*facet], first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return meshes;
|
return meshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue