当使用 cgal 读取 off-file 时,似乎 a 的顶点顺序face决定是否被read_OFF。但是 off-file 定义没有说明 a 的顶点顺序脸。
我正在使用 off-files https://doc.cgal.org/latest/Surface_mesh/group__PkgSurfaceMeshIOFuncOFF.html#ga84a04be1919414fbbaeb84edaf4fb111" rel="nofollow noreferrer">read_OFF cgal的方法:
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_3 = typename Kernel::Point_3;
...
CGAL::Surface_mesh<Point_3> test_mash;
CGAL::IO::read_OFF(file_name, test_mash);
std::cout << "Number of vertices: " << test_mash.vertices().size()
<< ", Number of faces: " << test_mash.faces().size() << std::endl;
two_faces_read.off:
OFF
4 2 0
1 1 1
2 -2 2
3 3 -3
-4 4 4
3 0 1 2
3 0 3 1
one_face_read.off:
OFF
4 2 0
1 1 1
2 -2 2
3 3 -3
-4 4 4
3 0 1 2
3 0 1 3
读取two_faces_read.off按预期工作,打印:
顶点数:4,面数:2
。
但是当我读到 one_face_read.off 时,我得到顶点数:4,面数:1
。这两个文件之间的唯一区别是最后一行,第二个面的顶点顺序不同。在尝试了所有可能的组合后,似乎使用 031、103、310 读入 2 个面,而使用 013、130、301 则仅读入 1 个面。
cgal引用的off-file规范没有提到任何关于顶点的规则一张脸的顺序。
为什么会发生这种情况以及如何确保读入所有面孔?
When reading an off-file with cgal it appears that the vertex order of a face decides whether or not it is read in by read_OFF. But the off-file definition does not say anything about the vertex order of a face.
I am reading in self generated off-files using the read_OFF method of cgal:
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_3 = typename Kernel::Point_3;
...
CGAL::Surface_mesh<Point_3> test_mash;
CGAL::IO::read_OFF(file_name, test_mash);
std::cout << "Number of vertices: " << test_mash.vertices().size()
<< ", Number of faces: " << test_mash.faces().size() << std::endl;
two_faces_read.off:
OFF
4 2 0
1 1 1
2 -2 2
3 3 -3
-4 4 4
3 0 1 2
3 0 3 1
one_face_read.off:
OFF
4 2 0
1 1 1
2 -2 2
3 3 -3
-4 4 4
3 0 1 2
3 0 1 3
Reading two_faces_read.off works as expected, printing:
Number of vertices: 4, Number of faces: 2
.
But when i read one_face_read.off i get Number of vertices: 4, Number of faces: 1
. The only difference between these two files is the last line, the vertex order of the second face is different. After trying all possible combinations it seems that with 031, 103, 310 2 faces are read in, while with 013, 130, 301 only 1 face is read in.
The off-file specification referenced by cgal does not mention any rules concerning the vertex order of a face.
Why does this happen and how can i ensure that all faces are read in?
发布评论
评论(1)
One_face_read.off
没有定义有效的表面网格具有两个面的方向不兼容。 You can use the following function to read points and faces and call < a href =“ https://doc.cgal.org/latest/polygon_mesh_processing/group__pmp__repairing__grp.html#ga8b9d12d12d817b5cc76f5a42a42a42d74eachod_ec75bf3 ing :: is_polygon_soup_a_polygon_mesh() 检查输入是否是有效的表面网。功能 可用于修复方向。 A>可用于创建网格。one_face_read.off
does not define a valid surface mesh has the orientation of the two faces are not compatible. You can use the following function to read points and faces and callCGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh()
to check if the input is a valid surface mesh. The functionCGAL::Polygon_mesh_processing::orient_polygon_soup()
can be used to fix orientations.CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh()
can be used to create the mesh.