mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 19:28:14 -06:00
Fix of the previous refactoring.
This commit is contained in:
parent
7dd842b294
commit
025f86ca3f
4 changed files with 27 additions and 24 deletions
|
@ -837,10 +837,12 @@ void stl_add_facet(stl_file *stl, const stl_facet *new_facet)
|
|||
{
|
||||
if (stl->error)
|
||||
return;
|
||||
++ stl->stats.facets_added;
|
||||
++ stl->stats.number_of_facets;
|
||||
stl->facet_start.emplace_back(*new_facet);
|
||||
assert(stl->facet_start.size() == stl->stats.number_of_facets);
|
||||
assert(stl->neighbors_start.size() == stl->stats.number_of_facets);
|
||||
stl->facet_start.emplace_back(*new_facet);
|
||||
// note that the normal vector is not set here, just initialized to 0.
|
||||
stl->facet_start[stl->stats.number_of_facets].normal = stl_normal::Zero();
|
||||
stl->neighbors_start.emplace_back();
|
||||
++ stl->stats.facets_added;
|
||||
++ stl->stats.number_of_facets;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ void stl_invalidate_shared_vertices(stl_file *stl)
|
|||
{
|
||||
stl->v_indices.clear();
|
||||
stl->v_shared.clear();
|
||||
stl->stats.shared_vertices = 0;
|
||||
}
|
||||
|
||||
void stl_generate_shared_vertices(stl_file *stl)
|
||||
|
@ -46,7 +47,7 @@ void stl_generate_shared_vertices(stl_file *stl)
|
|||
// 3 indices to vertex per face
|
||||
stl->v_indices.assign(stl->stats.number_of_facets, v_indices_struct());
|
||||
// Shared vertices (3D coordinates)
|
||||
stl->v_shared.assign(stl->stats.number_of_facets / 2, stl_vertex());
|
||||
stl->v_shared.reserve(stl->stats.number_of_facets / 2);
|
||||
stl->stats.shared_vertices = 0;
|
||||
|
||||
// A degenerate mesh may contain loops: Traversing a fan will end up in an endless loop
|
||||
|
|
|
@ -456,11 +456,16 @@ bool stl_validate(stl_file *stl)
|
|||
assert(! stl->error);
|
||||
assert(stl->fp == nullptr);
|
||||
assert(! stl->facet_start.empty());
|
||||
assert(stl->facet_start.size() == stl->stats.number_of_facets);
|
||||
assert(stl->neighbors_start.size() == stl->stats.number_of_facets);
|
||||
assert(stl->facet_start.size() == stl->neighbors_start.size());
|
||||
assert(stl->heads.empty());
|
||||
assert(stl->tail == nullptr);
|
||||
assert(! stl->neighbors_start.empty());
|
||||
assert((stl->v_indices.empty()) == (stl->v_shared.empty()));
|
||||
assert(stl->stats.number_of_facets > 0);
|
||||
assert(stl->v_shared.size() == stl->stats.shared_vertices);
|
||||
assert(stl->v_shared.empty() || stl->v_indices.size() == stl->stats.number_of_facets);
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Verify validity of neighborship data.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue