【发布时间】:2019-05-02 15:19:42
【问题描述】:
加载 .off 文件很容易:
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Surface_mesh<Kernel::Point_3> SurfaceMesh;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
...
SurfaceMesh surface;
Polyhedron poly;
std::fstream inputOffFile( "myFile.off" );
inputOffFile >> poly;
CGAL::copy_face_graph( poly, surface);
然后,我可以通过以下方式迭代顶点坐标:
std::vector<float> verts;
for( SurfaceMesh::Vertex_index vi : surface.vertices() )
{
Point pt = surface.point( vi );
verts.push_back( pt.x() );
verts.push_back( pt.y() );
verts.push_back( pt.z() );
}
但是我怎样才能访问存储在 .off 文件中的顶点颜色呢?
编辑:可能 CGAL::copy_face_graph 不复制颜色属性,所以我想我需要一种不同的方法?
【问题讨论】:
标签: c++ visual-studio 3d cgal