diff --git a/network_process/src/post_topo/filter_chains.cpp b/network_process/src/post_topo/filter_chains.cpp index 44028a0..81c86ab 100644 --- a/network_process/src/post_topo/filter_chains.cpp +++ b/network_process/src/post_topo/filter_chains.cpp @@ -1,5 +1,6 @@ #include #include "container/wrapper/relation_graph.hpp" +#include "fwd_types.hpp" void filter_chains(const stl_vector_mp& faces, const stl_vector_mp>& patches, @@ -24,11 +25,17 @@ void filter_chains(const stl_vector_mp& faces, return tri.chain_index == triangle.chain_index; }); if (iter == chain_triangles.end()) { - auto& mapped_tri = chain_triangles.emplace_back(); - mapped_tri.chain_index = tri.chain_index; - mapped_tri.v1 = vertex_old_index_to_unique_index.at(tri.v1); - mapped_tri.v2 = vertex_old_index_to_unique_index.at(tri.v2); - mapped_tri.v3 = vertex_old_index_to_unique_index.at(tri.v3); + auto v1_iter = vertex_old_index_to_unique_index.find(tri.v1); + auto v2_iter = vertex_old_index_to_unique_index.find(tri.v2); + auto v3_iter = vertex_old_index_to_unique_index.find(tri.v3); + if (v1_iter != vertex_old_index_to_unique_index.end() && v2_iter != vertex_old_index_to_unique_index.end() + && v3_iter != vertex_old_index_to_unique_index.end()) { + chain_triangle_t mapped_tri{}; + mapped_tri.v1 = v1_iter->second; + mapped_tri.v2 = v2_iter->second; + mapped_tri.v3 = v3_iter->second; + chain_triangles.emplace_back(mapped_tri); + } } else { // mark chain on this subface has double sides by all invalid vertex index iter->v1 = invalid_index; diff --git a/network_process/src/post_topo/patch_propagation.cpp b/network_process/src/post_topo/patch_propagation.cpp index 6d6408b..b43af3d 100644 --- a/network_process/src/post_topo/patch_propagation.cpp +++ b/network_process/src/post_topo/patch_propagation.cpp @@ -118,13 +118,14 @@ dynamic_bitset_mp<> filter_cells_by_boolean(const baked_blobtree_t& // do bool operation, util meet next primitive node. assert(iter->is_operation_node()); + // HINT: other_cell_signs here should always be left nodes const auto& other_cell_sign = stacked_nodes.top().cell_signs; switch (iter->get_operation()) { case internal::eNodeOperation::unionOp: temp_info.cell_signs |= other_cell_sign; break; case internal::eNodeOperation::intersectionOp: temp_info.cell_signs &= other_cell_sign; break; case internal::eNodeOperation::differenceOp: // stacked nodes are always left childs - temp_info.cell_signs &= ~other_cell_sign; + temp_info.cell_signs = other_cell_sign & ~temp_info.cell_signs; break; default: throw std::runtime_error("ERROR: baked blobtree with unknown type operation node"); break; }