From aba4e29e2f05067220371d719f8d1591283e4a24 Mon Sep 17 00:00:00 2001 From: mckay Date: Wed, 22 Oct 2025 20:42:40 +0800 Subject: [PATCH] revert(process): remove exort obj --- network_process/src/process.cpp | 82 --------------------------------- 1 file changed, 82 deletions(-) diff --git a/network_process/src/process.cpp b/network_process/src/process.cpp index 6080cc3..a47475c 100644 --- a/network_process/src/process.cpp +++ b/network_process/src/process.cpp @@ -7,86 +7,6 @@ #include #include "post_topo/chain_post_processing.hpp" -void export_halfpatch_obj( - const stl_vector_mp& iso_pts, - const stl_vector_mp& iso_faces, - const stl_vector_mp>& patches, - const std::string& filename) -{ - std::string mtl_filename = filename + ".mtl"; - std::ofstream mtl(mtl_filename); - for (size_t half_patch = 0; half_patch < patches.size() * 2; ++half_patch) { - size_t patch_idx = half_patch / 2; - bool is_forward = (half_patch % 2 == 0); - mtl << "newmtl patch_" << patch_idx << (is_forward ? "_in" : "_out") << "\n"; - // 随机或规律分配颜色 - float r = float(patch_idx % 7) / 7.0f; - float g = is_forward ? 0.8f : 0.2f; - float b = 1.0f - r; - mtl << "Kd " << r << " " << g << " " << b << "\n"; - } - mtl.close(); - - std::string obj_filename = filename + ".obj"; - std::ofstream ofs(obj_filename); - if (!ofs) return; - - ofs << "mtllib "<< mtl_filename << "\n"; - - // 输出所有顶点 - for (const auto& v : iso_pts) { - ofs << "v " << v.x() << " " << v.y() << " " << v.z() << "\n"; - } - - // 遍历所有 half-patch - for (size_t half_patch = 0; half_patch < patches.size() * 2; ++half_patch) { - size_t patch_idx = half_patch / 2; - bool is_forward = (half_patch % 2 == 0); - ofs << "g halfpatch_" << half_patch << "\n"; - ofs << "usemtl patch_" << patch_idx << (is_forward ? "_in" : "_out") << "\n"; - for (auto face_idx : patches[patch_idx]) { - const auto& face = iso_faces[face_idx]; - ofs << "f"; - if (is_forward) { - for (auto vi : face.vertex_indices) - ofs << " " << (vi + 1); - } else { - for (auto it = face.vertex_indices.rbegin(); it != face.vertex_indices.rend(); ++it) - ofs << " " << (*it + 1); - } - ofs << "\n"; - } - } - ofs.close(); -} - - -// Export OBJ without patch information -void export_obj_no_patch( - const stl_vector_mp& iso_pts, - const stl_vector_mp& iso_faces, - const std::string& filename) -{ - // Write OBJ file - std::string obj_filename = filename + ".obj"; - std::ofstream ofs(obj_filename); - if (!ofs) return; - - // Write all vertices - for (const auto& v : iso_pts) { - ofs << "v " << v.x() << " " << v.y() << " " << v.z() << "\n"; - } - - // Write all faces - for (const auto& face : iso_faces) { - ofs << "f"; - for (auto vi : face.vertex_indices) - ofs << " " << (vi + 1); - ofs << "\n"; - } - ofs.close(); -} - ISNP_API void build_implicit_network_by_blobtree(const s_settings& settings, const baked_blobtree_t& tree, stl_vector_mp& output_vertices, @@ -154,7 +74,6 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& iso_verts, iso_faces); } - export_obj_no_patch(iso_pts, iso_faces, "halfpatch_bbefore_connect"); // connect components by topology stl_vector_mp patch_of_face(iso_faces.size()); stl_vector_mp shell_of_half_patch{}; @@ -278,6 +197,5 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& remap_parametric_plane_vertices(output_parametric_planes); } } - export_halfpatch_obj(iso_pts, iso_faces, patches, "halfpatch_final"); } } \ No newline at end of file