diff options
author | bubnikv <bubnikv@gmail.com> | 2019-06-10 19:30:54 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-06-10 19:30:54 +0300 |
commit | 6defabea537ba871070fc405a14c2173cb92fc89 (patch) | |
tree | d1df60d45ebeb9068d9e322ca103ea3b32f8c4be /xs | |
parent | 65238a89b10fb18e7f9b647f5026da9276d32d58 (diff) |
admesh refactoring: separation of the shared vertices / indices
into an indexed_triangle_set structure
Diffstat (limited to 'xs')
-rw-r--r-- | xs/xsp/TriangleMesh.xsp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp index 53b052027..3e90bfefd 100644 --- a/xs/xsp/TriangleMesh.xsp +++ b/xs/xsp/TriangleMesh.xsp @@ -98,20 +98,18 @@ SV* TriangleMesh::vertices() CODE: if (!THIS->repaired) CONFESS("vertices() requires repair()"); - - if (THIS->stl.v_shared.empty()) - stl_generate_shared_vertices(&(THIS->stl)); + THIS->require_shared_vertices(); // vertices AV* vertices = newAV(); - av_extend(vertices, THIS->stl.v_shared.size()); - for (size_t i = 0; i < THIS->stl.v_shared.size(); i++) { + av_extend(vertices, THIS->its.vertices.size()); + for (size_t i = 0; i < THIS->its.vertices.size(); i++) { AV* vertex = newAV(); av_store(vertices, i, newRV_noinc((SV*)vertex)); av_extend(vertex, 2); - av_store(vertex, 0, newSVnv(THIS->stl.v_shared[i](0))); - av_store(vertex, 1, newSVnv(THIS->stl.v_shared[i](1))); - av_store(vertex, 2, newSVnv(THIS->stl.v_shared[i](2))); + av_store(vertex, 0, newSVnv(THIS->its.vertices[i](0))); + av_store(vertex, 1, newSVnv(THIS->its.vertices[i](1))); + av_store(vertex, 2, newSVnv(THIS->its.vertices[i](2))); } RETVAL = newRV_noinc((SV*)vertices); @@ -122,9 +120,7 @@ SV* TriangleMesh::facets() CODE: if (!THIS->repaired) CONFESS("facets() requires repair()"); - - if (THIS->stl.v_shared.empty()) - stl_generate_shared_vertices(&(THIS->stl)); + THIS->require_shared_vertices(); // facets AV* facets = newAV(); @@ -133,9 +129,9 @@ TriangleMesh::facets() AV* facet = newAV(); av_store(facets, i, newRV_noinc((SV*)facet)); av_extend(facet, 2); - av_store(facet, 0, newSVnv(THIS->stl.v_indices[i].vertex[0])); - av_store(facet, 1, newSVnv(THIS->stl.v_indices[i].vertex[1])); - av_store(facet, 2, newSVnv(THIS->stl.v_indices[i].vertex[2])); + av_store(facet, 0, newSVnv(THIS->its.indices[i].vertex[0])); + av_store(facet, 1, newSVnv(THIS->its.indices[i].vertex[1])); + av_store(facet, 2, newSVnv(THIS->its.indices[i].vertex[2])); } RETVAL = newRV_noinc((SV*)facets); |