Make new split always default if feasible
This commit is contained in:
parent
97529ff6b7
commit
0ca17b0798
@ -451,9 +451,21 @@ std::deque<uint32_t> TriangleMesh::find_unvisited_neighbors(std::vector<unsigned
|
|||||||
*/
|
*/
|
||||||
TriangleMeshPtrs TriangleMesh::split() const
|
TriangleMeshPtrs TriangleMesh::split() const
|
||||||
{
|
{
|
||||||
|
struct MeshAdder {
|
||||||
|
TriangleMeshPtrs &meshes;
|
||||||
|
MeshAdder(TriangleMeshPtrs &ptrs): meshes{ptrs} {}
|
||||||
|
void operator=(const indexed_triangle_set &its)
|
||||||
|
{
|
||||||
|
meshes.emplace_back(new TriangleMesh(its));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TriangleMeshPtrs meshes;
|
||||||
|
if (has_shared_vertices()) {
|
||||||
|
its_split(its, MeshAdder{meshes});
|
||||||
|
} else {
|
||||||
// Loop while we have remaining facets.
|
// Loop while we have remaining facets.
|
||||||
std::vector<unsigned char> facet_visited;
|
std::vector<unsigned char> facet_visited;
|
||||||
TriangleMeshPtrs meshes;
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
std::deque<uint32_t> facets = find_unvisited_neighbors(facet_visited);
|
std::deque<uint32_t> facets = find_unvisited_neighbors(facet_visited);
|
||||||
if (facets.empty())
|
if (facets.empty())
|
||||||
@ -474,6 +486,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…
Reference in New Issue
Block a user