从CGAL 3D网格物体生成获取-6.27744e + 66的顶点坐标:mesh_implicit_sphere示例

我正在使用标题中提到的示例代码从生成的网格中提取构面数据,其中包括:

 vector<CGAL::Mesh_complex_3_in_triangulation_3<Tr>::Facet_iterator> Facets;
    for (CGAL::Mesh_complex_3_in_triangulation_3<Tr>::Facet_iterator it = c3t3.facets_begin(); it!=c3t3.facets_end() ; it++)
    {
        Facets.push_back(it);
    }

现在尝试显示一些顶点坐标,如下所示:

CGAL::Mesh_complex_3_in_triangulation_3<Tr>::Facet_iterator fct = Facets[0];
cout << "Vertex 0 has coordinate: \n";
    cout << fct->first->vertex(0)->point().x() << ", " 
        << fct->first->vertex(0)->point().y() << ", "
        << fct->first->vertex(0)->point().z() << endl<<endl; 

    cout<< "Vertex 1 has coordinate: \n";
    cout << fct->first->vertex(1)->point().x() << ", "
        << fct->first->vertex(1)->point().y() << ", "
        << fct->first->vertex(1)->point().z() << endl<<endl;

    cout << "Vertex 2 has coordinate: \n";
    cout << fct->first->vertex(2)->point().x() << ", "
        << fct->first->vertex(2)->point().y() << ", "
        << fct->first->vertex(2)->point().z() << endl<<endl;

    cout << "Vertex 3 has coordinate: \n";
    cout << fct->first->vertex(3)->point().x() << ", "
        << fct->first->vertex(3)->point().y() << ", "
        << fct->first->vertex(3)->point().z() << endl<<endl<<endl;

(假设我正确理解了数据结构)fct指向包含(c,i)的std :: pair,这意味着:单元c中以fct表示的面和索引为i的顶点都属于单元c,它们满足: fct与顶点i相反。所以我的代码应该显示单元格fct-> first的顶点坐标(这是一个四面体,因此有四个顶点)。

这是我的问题

上面代码的输出是:

顶点0具有坐标: 0.282254,-0.638274,-0.716464

顶点1具有坐标: 0.408885,-0.669831,-0.621398

顶点2具有坐标: 0.24175,-0.741988,-0.625771

顶点3具有坐标: -6.27744e + 66,-6.27744e + 66,-6.27744e + 66

Vertex3的坐标显然不正确,我搜索了这个问题,发现-6.27744e + 66通常来自喜欢访问未初始化矢量的事物。但是,即使是这种情况,我应该怎么做才能获得正确的值?或者,有人可以告诉我哪里出了问题吗?

评论