0
我已經定義並加載一個表面網格的建議在here:typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Surface_mesh;
,但使用這種 算法Triangulated Surface Mesh Segmentation我需要一個多面體一樣:如何將Surface Mesh變成多面體?
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
但我不明白如何把一個到另一個。如何在CGAL中做這樣的事情?
簡化演示:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/mesh_segmentation.h>
#include <CGAL/Polygon_mesh_processing/connected_components.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Surface_mesh;
int main()
{
// create and read Polyhedron
Surface_mesh mesh_in, mesh_out;
Polyhedron mesh;
OpenMesh::IO::read_mesh(mesh_in, "data/elephant.off");
CGAL::copy_face_graph(mesh_in, mesh);
CGAL::copy_face_graph(mesh, mesh_out);
if (!OpenMesh::IO::write_mesh(mesh_out, "slon.obj"))
{
std::cerr << "write error\n";
exit(1);
}
}
哪個編譯失敗由於
boost_1_63_0 \升壓/圖形/ graph_traits.hpp(57):錯誤C2039: vertex_descriptor的:不是成員的 「OpenMesh :: PolyMesh_ArrayKernelT < OpenMesh :: DefaultTraits>」
增加了編譯失敗的代碼,並使用了建議的'CGAL :: copy_face_graph()'函數 – DuckQueen
您缺少'#include'。 –
sloriot