CGAL::Polyhedron_3 使用 make_tetrahedron() 生成不需要的重复顶点,如何解决?

CGAL::Polyhedron_3 makes unwanted duplicated vertices using make_tetrahedron(), how to solve it?

我正在尝试使用 CGAL::Polyhedron_3 data structure when, doing some tests, I noticed that the make_tetrahedron 函数创建体积网格,复制多面体中已经存在的顶点。

示例:共用一个面的两个四面体

这是我试过的代码:

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <iostream>

typedef CGAL::Simple_cartesian<double>     Kernel;
typedef Kernel::Point_3                    Point_3;
typedef CGAL::Polyhedron_3<Kernel>         Polyhedron;
typedef Polyhedron::Vertex_iterator        Vertex_iterator;

int main(void) {
    // common points
    Point_3 p( 1.0, 0.0, 0.0 );
    Point_3 q( 0.0, 1.0, 0.0 );
    Point_3 s( 0.0, 0.0, 0.0 );

    // the other two
    Point_3 r( 0.0, 0.0, 1.0 );
    Point_3 d( 0.0, 0.0,-1.0 );

    Polyhedron P;
    P.make_tetrahedron( p, q, r, s );
    P.make_tetrahedron( p, q, s, d );

    CGAL::IO::set_ascii_mode( std::cout );
    
    // printing out the vertices
    for ( Vertex_iterator v = P.vertices_begin(); v != P.vertices_end(); ++v )
        std::cout << v->point() << std::endl;

    return 0;
}

这是我希望看到的输出:

1 0 0
0 1 0
0 0 1
0 0 0
0 0 -1

但这就是我得到的:
1 0 0
0 1 0
0 0 1
0 0 0
1 0 0
0 1 0
0 0 0
0 0 -1

现在,问题是:
是否可以在 CGAL::Polyhedron_3 using the make_tetrahedron 函数中仅将一个点存储为顶点一次?

您不能在多面体中存储非流形特征,您需要类似线性单元复合体的东西。参见 here