Replace TriangleMesh with the XS port

This commit is contained in:
Alessandro Ranellucci 2013-09-10 00:40:46 +02:00
parent 311eda7d42
commit 566d38a472
14 changed files with 77 additions and 256 deletions

View file

@ -16,14 +16,22 @@ TriangleMesh::TriangleMesh(const TriangleMesh &other)
{
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)
if (other.stl.facet_start != NULL) {
this->stl.facet_start = new stl_facet[other.stl.stats.number_of_facets];
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) {
this->stl.neighbors_start = new stl_neighbors[other.stl.stats.number_of_facets];
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);
}
if (other.stl.v_indices != NULL) {
this->stl.v_indices = new v_indices_struct[other.stl.stats.number_of_facets];
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) {
this->stl.v_shared = new stl_vertex[other.stl.stats.shared_vertices];
std::copy(other.stl.v_shared, other.stl.v_shared + other.stl.stats.shared_vertices, this->stl.v_shared);
}
}
TriangleMesh::~TriangleMesh() {
@ -33,7 +41,7 @@ TriangleMesh::~TriangleMesh() {
SV*
TriangleMesh::to_SV() {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::TriangleMesh::XS", (void*)this );
sv_setref_pv( sv, "Slic3r::TriangleMesh", (void*)this );
return sv;
}