Implemented TriangleMesh->clone

This commit is contained in:
Alessandro Ranellucci 2013-09-10 00:09:56 +02:00
parent 9b12d6037a
commit 311eda7d42
4 changed files with 25 additions and 2 deletions

View file

@ -11,8 +11,23 @@
namespace Slic3r {
TriangleMesh::TriangleMesh(const TriangleMesh &other)
: stl(other.stl), repaired(other.repaired)
{
this->stl.heads = NULL;
this->stl.tail = NULL;
if (other.stl.facet_start != NULL)
std::copy(other.stl.facet_start, other.stl.facet_start + other.stl.stats.number_of_facets, this->stl.facet_start);
if (other.stl.neighbors_start != NULL)
std::copy(other.stl.neighbors_start, other.stl.neighbors_start + other.stl.stats.number_of_facets, this->stl.neighbors_start);
if (other.stl.v_indices != NULL)
std::copy(other.stl.v_indices, other.stl.v_indices + other.stl.stats.number_of_facets, this->stl.v_indices);
if (other.stl.v_shared != NULL)
std::copy(other.stl.v_shared, other.stl.v_shared + other.stl.stats.shared_vertices, this->stl.v_shared);
}
TriangleMesh::~TriangleMesh() {
stl_close(&stl);
stl_close(&this->stl);
}
SV*