From b864ef0aa3965442c2ea27240f058d43555607b9 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang <1627343141@qq.com> Date: Sat, 2 Aug 2025 16:31:33 +0800 Subject: [PATCH 1/3] fix some internal error --- network_process/include/prim_gen.hpp | 2 +- network_process/src/prim_gen/filter_tet_by_subface.cpp | 3 ++- network_process/src/process.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/network_process/include/prim_gen.hpp b/network_process/include/prim_gen.hpp index 8901fd1..51e7b71 100644 --- a/network_process/include/prim_gen.hpp +++ b/network_process/include/prim_gen.hpp @@ -19,7 +19,7 @@ void build_tetrahedron_and_adjacency(const scene_bg_mesh_info flat_hash_map_mp>& reverse_vertex_adjacency, btree_map_mp>& vertex_to_tet_mapping); void filter_tet_by_subface(const btree_map_mp>& vertex_to_tet_mapping, - Eigen::Ref vertex_infos, + Eigen::MatrixXd& vertex_infos, flat_hash_map_mp& vertex_indices_mapping, stl_vector_mp>& tetrahedrons, flat_hash_map_mp& vertex_lexigraphical_adjacency, diff --git a/network_process/src/prim_gen/filter_tet_by_subface.cpp b/network_process/src/prim_gen/filter_tet_by_subface.cpp index b03d9cd..ff8dded 100644 --- a/network_process/src/prim_gen/filter_tet_by_subface.cpp +++ b/network_process/src/prim_gen/filter_tet_by_subface.cpp @@ -16,7 +16,7 @@ // }; void filter_tet_by_subface(const btree_map_mp>& vertex_to_tet_mapping, - Eigen::Ref vertex_infos, + Eigen::MatrixXd& vertex_infos, flat_hash_map_mp& vertex_indices_mapping, stl_vector_mp>& tetrahedrons, flat_hash_map_mp& vertex_lexigraphical_adjacency, @@ -140,6 +140,7 @@ void filter_tet_by_subface(const btree_map_mp> filtered_vertex_lexigraphical_adjacency.emplace(vertex_index, vertex_indices_mapping.at(vertex_index)); filtered_vert_infos_iter++; } + vertex_infos.resize(filtered_vert_infos.rows(), filtered_vert_infos.cols()); vertex_infos = std::move(filtered_vert_infos); vertex_lexigraphical_adjacency = std::move(filtered_vertex_lexigraphical_adjacency); } \ No newline at end of file diff --git a/network_process/src/process.cpp b/network_process/src/process.cpp index 8c9aeab..36fea8c 100644 --- a/network_process/src/process.cpp +++ b/network_process/src/process.cpp @@ -106,6 +106,10 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& { arrangement_cells.reserve(shells.size()); for (uint32_t i = 0; i < shells.size(); ++i) { arrangement_cells.emplace_back(stl_vector_mp{i}); } + shell_to_cell.resize(shells.size()); + for (uint32_t i = 0; i < arrangement_cells.size(); i++) { + for (auto shell : arrangement_cells[i]) shell_to_cell[shell] = i; + } } else { { stl_vector_mp> shell_links{}; @@ -124,10 +128,6 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& shell_links); compute_arrangement_cells(static_cast(shells.size()), shell_links, arrangement_cells); } - shell_to_cell.resize(shells.size()); - for (uint32_t i = 0; i < arrangement_cells.size(); i++) { - for (auto shell : arrangement_cells[i]) shell_to_cell[shell] = i; - } } // post process { From 1672bc41f2bab6fb046566f07ae0d1ba617a6d2d Mon Sep 17 00:00:00 2001 From: mckay Date: Sat, 2 Aug 2025 23:34:08 +0800 Subject: [PATCH 2/3] fix: update filter_cells_by_boolean to handle empty stack and assert parent index correctly --- network_process/src/post_topo/patch_propagation.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/network_process/src/post_topo/patch_propagation.cpp b/network_process/src/post_topo/patch_propagation.cpp index d7574ad..81c71a5 100644 --- a/network_process/src/post_topo/patch_propagation.cpp +++ b/network_process/src/post_topo/patch_propagation.cpp @@ -141,12 +141,13 @@ dynamic_bitset_mp<> filter_cells_by_boolean(const baked_blobtree_t& stacked_nodes.emplace(std::move(front_info)); iter++; - while (iter != tree.nodes.end() - 1) { - // each out iteration must start with leaf node + while (iter != tree.nodes.end()) { + // each out iteration must start with leaf node, only 1 leaf node is absorbed in one iteration assert(iter->is_primitive_node()); compact_node_info temp_info{std::move(cell_primitive_signs[iter->primitive_index]), iter->parent_index}; iter++; // to parent or neighboring node - while (temp_info.parent_index == stacked_nodes.top().parent_index) { + while (!stacked_nodes.empty() && temp_info.parent_index == stacked_nodes.top().parent_index) { + // do bool operation, util meet next primitive node. assert(iter->is_operation_node()); const auto& other_cell_sign = stacked_nodes.top().cell_signs; @@ -168,7 +169,7 @@ dynamic_bitset_mp<> filter_cells_by_boolean(const baked_blobtree_t& } assert(stacked_nodes.size() == 1); - assert(stacked_nodes.top().parent_index == tree.nodes.size() - 1); + assert(stacked_nodes.top().parent_index == 0xFFFFFFFF); return stacked_nodes.top().cell_signs; } \ No newline at end of file From 10f309c9966d2123fa2c671056419fa069c2bc9a Mon Sep 17 00:00:00 2001 From: Zhicheng Wang <1627343141@qq.com> Date: Sat, 16 Aug 2025 22:18:23 +0800 Subject: [PATCH 3/3] fix logical error of cylinder's plane --- network_process/src/process.cpp | 8 ++++---- primitive_process/interface/data/data_type.hpp | 14 ++++++++++++-- .../src/primitive/simple/cylinder.cpp | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/network_process/src/process.cpp b/network_process/src/process.cpp index 36fea8c..22c6845 100644 --- a/network_process/src/process.cpp +++ b/network_process/src/process.cpp @@ -106,10 +106,6 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& { arrangement_cells.reserve(shells.size()); for (uint32_t i = 0; i < shells.size(); ++i) { arrangement_cells.emplace_back(stl_vector_mp{i}); } - shell_to_cell.resize(shells.size()); - for (uint32_t i = 0; i < arrangement_cells.size(); i++) { - for (auto shell : arrangement_cells[i]) shell_to_cell[shell] = i; - } } else { { stl_vector_mp> shell_links{}; @@ -129,6 +125,10 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& compute_arrangement_cells(static_cast(shells.size()), shell_links, arrangement_cells); } } + shell_to_cell.resize(shells.size()); + for (uint32_t i = 0; i < arrangement_cells.size(); i++) { + for (auto shell : arrangement_cells[i]) shell_to_cell[shell] = i; + } // post process { dynamic_bitset_mp<> active_cell_label{}; diff --git a/primitive_process/interface/data/data_type.hpp b/primitive_process/interface/data/data_type.hpp index e5ce164..7348ad2 100644 --- a/primitive_process/interface/data/data_type.hpp +++ b/primitive_process/interface/data/data_type.hpp @@ -25,7 +25,17 @@ const auto plane_to_z_pos_1_model_matrix = []() { res.world_to_local.linear().col(2) = Eigen::Vector3d{1, 0, 0}; res.world_to_local.translation() = Eigen::Vector3d{-1, 0, 0}; res.local_to_world = res.world_to_local; - res.local_to_world.translation() = Eigen::Vector3d{1, 0, 0}; + res.local_to_world.translation() = Eigen::Vector3d{0, 0, 1}; + return res; +}(); +const auto plane_to_z_model_matrix = []() { + paired_model_matrix res{}; + Eigen::Matrix3d::Identity(); + res.world_to_local.linear().col(0) = Eigen::Vector3d{0, 0, 1}; + res.world_to_local.linear().col(1) = Eigen::Vector3d{0, 1, 0}; + res.world_to_local.linear().col(2) = Eigen::Vector3d{1, 0, 0}; + res.world_to_local.translation() = Eigen::Vector3d{0, 0, 0}; + res.local_to_world = res.world_to_local; return res; }(); const auto plane_to_z_neg_1_model_matrix = []() { @@ -35,7 +45,7 @@ const auto plane_to_z_neg_1_model_matrix = []() { res.world_to_local.linear().col(2) = Eigen::Vector3d{1, 0, 0}; res.world_to_local.translation() = Eigen::Vector3d{1, 0, 0}; res.local_to_world = res.world_to_local; - res.local_to_world.translation() = Eigen::Vector3d{-1, 0, 0}; + res.local_to_world.translation() = Eigen::Vector3d{0, 0, -1}; return res; }(); diff --git a/primitive_process/src/primitive/simple/cylinder.cpp b/primitive_process/src/primitive/simple/cylinder.cpp index 32243c9..da6c6c5 100644 --- a/primitive_process/src/primitive/simple/cylinder.cpp +++ b/primitive_process/src/primitive/simple/cylinder.cpp @@ -4,7 +4,7 @@ namespace internal { void cylinder_t::initialize(primitive_data_center_t &data_center) { - auto [bottom_plane_iter, _] = data_center.transform_blocks.acquire(internal::plane_to_z_neg_1_model_matrix); + auto [bottom_plane_iter, _] = data_center.transform_blocks.acquire(internal::plane_to_z_model_matrix); auto [cylinder_iter, __] = data_center.transform_blocks.acquire(internal::identity_model_matrix); auto [top_plane_iter, ___] = data_center.transform_blocks.acquire(internal::plane_to_z_pos_1_model_matrix); initialize(data_center,