diff --git a/projects/Geometry/README.md b/projects/Geometry/README.md new file mode 100644 index 0000000000..666460bcfb --- /dev/null +++ b/projects/Geometry/README.md @@ -0,0 +1,41 @@ +## QuadMesh节点参数说明 +| 参数 | 类型 | 说明 | +| --- | ---- | --- | +| prim | PrimitiveObject | 输入三角形网格。 | +| deterministic | bool | 使用较慢的确定性算法。 | +| crease | float | 判断为折痕的二面角阈值。 | +| smooth_iter | int | 平滑和光线追踪重投影的次数(默认2)。 | +| quad_dominant | bool | 生成以四边形为主的三角形-四边形混合网格。 | +| intrinsic | bool | 使用intrinsic方法(默认extrinsic方法)。 | +| boundary | bool | 对于非闭合的表面,保持边缘轮廓。(有保留边的输入时自动开启) | +| scale | float | 期望的世界坐标下边长。(与vert_num, face_num至多同时指定一项) | +| vert_num | int | 期望点数。 | +| face_num | int | 期望面数。 | +| line_pick_tag | string | 保留的边的属性名称,属性应为int类型,该属性值为1的边被保留。只能保留边方向,不能严格固定顶点位置。 | +| marked_lines | list of vec2i | 保留的边的列表。只能保留边方向,不能严格固定顶点位置。 | + + +## fTetWild节点参数说明 +| 参数 | 类型 | 说明 | +| --- | ---- | --- | +| prim | PrimitiveObject | 输入三角形网格。 | +| input_dir | readpath | 输入三角形网格文件路径。如果有prim输入则忽略此项。 | +| output_dir | string | 输出四面体网格文件路径。若为空,当以prim输入时则不输出任何文件,以文件读入时则输出到“<原路经>/<原文件名>_.msh” | +| tag | readpath | 输入用于布尔运算的面片标记的文件路径。 | +| operation | enum | 布尔运算种类 | +| edge_length | float | 期望相对边长。默认0.05。 | +| epsilon | float | 期望相对偏差。默认1e-3。 | +| stop_energy | float | 停止优化的能量阈值。默认10。 | +| skip_simplify | bool | 跳过预处理。 | +| no_binary | bool | 以ascii格式输出。(仅在有输出文件时生效) | +| no_color | bool | 不输出颜色。(仅在有输出文件时生效) | +| smooth_open_boundary | bool | 对于非闭合表面,光滑其边缘。 | +| export_raw | bool | 输出原始结果。 | +| manifold_surface | bool | 处理输出为流形。 | +| coarsen | bool | 尽可能使输出稀疏。 | +| csg | readpath | 包含csg树的json文件路径。 | +| disable_filtering | bool | 不过滤掉外部的元素。 | +| use_floodfill | bool | 使用泛洪法提取内部体积。 | +| use_general_wn | bool | 使用通常的绕数。 | +| use_input_for_wn | bool | 使用输入表面得到绕数。 | +| bg_mesh | readpath | 用于得到长度场的背景网格(.msh格式)文件路径 | \ No newline at end of file diff --git a/projects/Geometry/fTetWild b/projects/Geometry/fTetWild index b20ca8700d..5d72cc0866 160000 --- a/projects/Geometry/fTetWild +++ b/projects/Geometry/fTetWild @@ -1 +1 @@ -Subproject commit b20ca8700dbe80ea4929b5cbda44367cb258bbf7 +Subproject commit 5d72cc0866b70840a361bb66c1cbf0c09c2d0718 diff --git a/projects/Geometry/quadmesh.cpp b/projects/Geometry/quadmesh.cpp index 4de1aff6fa..e819fc2cea 100644 --- a/projects/Geometry/quadmesh.cpp +++ b/projects/Geometry/quadmesh.cpp @@ -23,7 +23,7 @@ struct QuadMesh : INode { float scale = get_input2("scale"); int vert_num = get_input2("vert_num"); int face_num = get_input2("face_num"); - int knn = get_input2("knn"); + // int knn = get_input2("knn"); auto line_pick_tag = get_input("line_pick_tag")->get(); if (prim->verts.size() < 4) { @@ -142,16 +142,16 @@ struct QuadMesh : INode { argv[argc+1][face_num_str.size()] = '\0'; argc += 2; } - if (knn > 0) { - argv[argc] = (char*)malloc(sizeof("--knn\0")); - strcpy(argv[argc], "--knn\0"); - std::string knn_str = to_string(knn); - argv[argc+1] = (char*)malloc((knn_str.size()+1)*sizeof(char)); - for (int i = 0; i < knn_str.size(); ++i) - argv[argc+1][i] = knn_str[i]; - argv[argc+1][knn_str.size()] = '\0'; - argc += 2; - } + // if (knn > 0) { + // argv[argc] = (char*)malloc(sizeof("--knn\0")); + // strcpy(argv[argc], "--knn\0"); + // std::string knn_str = to_string(knn); + // argv[argc+1] = (char*)malloc((knn_str.size()+1)*sizeof(char)); + // for (int i = 0; i < knn_str.size(); ++i) + // argv[argc+1][i] = knn_str[i]; + // argv[argc+1][knn_str.size()] = '\0'; + // argc += 2; + // } std::vector> faces(prim->tris->size(), std::vector{}); std::vector> verts(prim->verts->size(), std::vector{}); @@ -208,7 +208,7 @@ ZENO_DEFNODE(QuadMesh) {"float", "scale", "0"}, {"int", "vert_num", "0"}, {"int", "face_num", "0"}, - {"int", "knn", "0"}, + // {"int", "knn", "0"}, {"string", "line_pick_tag", "line_selected"}, {"marked_lines"}}, {{"prim"}}, diff --git a/projects/Geometry/tetmesh.cpp b/projects/Geometry/tetmesh.cpp index 7737f13c36..b4d7e41698 100644 --- a/projects/Geometry/tetmesh.cpp +++ b/projects/Geometry/tetmesh.cpp @@ -14,7 +14,9 @@ namespace zeno { struct FTetWild : INode { virtual void apply() override { + auto prim = get_input("prim"); auto input_dir = get_input2("input_dir"); + input_dir.erase(input_dir.find_last_not_of(" ")+1); auto output_dir = get_input2("output_dir"); auto tag = get_input2("tag"); tag.erase(tag.find_last_not_of(" ")+1); @@ -197,13 +199,35 @@ struct FTetWild : INode { strcpy(argv[argc+1], "3\0"); argc += 2; - runFTetWild(argc, argv); + std::vector> faces(prim->tris->size(), std::vector{}); + std::vector> verts(prim->verts->size(), std::vector{}); + for (int i = 0; i < prim->tris->size(); ++i) + for (int j = 0; j < 3; ++j) + faces[i].push_back(prim->tris[i][j]); + for (int i = 0; i < prim->verts->size(); ++i) + for (int j = 0; j < 3; ++j) + verts[i].push_back(prim->verts[i][j]); + + runFTetWild(faces, verts, argc, argv); + + prim->quads.clear(); + prim->quads.resize(faces.size()); + prim->verts.clear(); + prim->verts.resize(verts.size()); + for (int i = 0; i < faces.size(); ++i) + for (int j = 0; j < 4; ++j) + prim->quads[i][j] = faces[i][j]; + for (int i = 0; i < verts.size(); ++i) + for (int j = 0; j < 3; ++j) + prim->verts[i][j] = verts[i][j]; + set_output("prim", std::move(prim)); } }; ZENO_DEFNODE(FTetWild) ({ - {{"readpath", "input_dir"}, + {{"prim"}, + {"readpath", "input_dir", " "}, {"string", "output_dir"}, {"readpath", "tag", " "}, {"enum none union intersection difference", "operation", "none"}, @@ -223,7 +247,7 @@ ZENO_DEFNODE(FTetWild) {"bool", "use_general_wn", "0"}, {"bool", "use_input_for_wn", "0"}, {"readpath", "bg_mesh", " "}}, - {}, + {("prim")}, {}, {"primitive"}, });