mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Implemented TriangleMesh->merge
This commit is contained in:
parent
27e7c6b9f7
commit
3919ba83d8
6 changed files with 29 additions and 3 deletions
|
@ -525,4 +525,23 @@ TriangleMesh::split() const
|
|||
return meshes;
|
||||
}
|
||||
|
||||
void
|
||||
TriangleMesh::merge(const TriangleMesh* mesh)
|
||||
{
|
||||
// reset stats and metadata
|
||||
int number_of_facets = this->stl.stats.number_of_facets;
|
||||
stl_initialize(&this->stl);
|
||||
stl_invalidate_shared_vertices(&this->stl);
|
||||
|
||||
// update facet count and allocate more memory
|
||||
this->stl.stats.number_of_facets = number_of_facets + mesh->stl.stats.number_of_facets;
|
||||
this->stl.stats.original_num_facets = this->stl.stats.number_of_facets;
|
||||
stl_reallocate(&this->stl);
|
||||
|
||||
// copy facets
|
||||
for (int i = 0; i < mesh->stl.stats.number_of_facets; i++) {
|
||||
this->stl.facet_start[number_of_facets + i] = mesh->stl.facet_start[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue