mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
admesh refactoring: separation of the shared vertices / indices
into an indexed_triangle_set structure
This commit is contained in:
parent
65238a89b1
commit
6defabea53
11 changed files with 154 additions and 162 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue