如何在CGAL中加载Coff Mesh

How to load COFF mesh in cgal?

本文关键字:加载 Coff Mesh CGAL      更新时间:2023-10-16

我想使用cgal :: read_off((加载coff文件(带有颜色的网格(。下一个尝试将这些信息组合到网格变量中(类似于polygon_soup_to_polygon_mesh函数,但不确定,因为此命令也不支持颜色信息(。您知道如何读取一个库存文件并将其合并为包含颜色信息的网格?

  bool
  read_OFF( std::istream& in,
            std::vector< Point_3 >& points,
            std::vector< Polygon_3 >& polygons,
            std::vector<Color_rgb>& fcolors,
            std::vector<Color_rgb>& vcolors,
            bool /* verbose */ = false)

,然后

这是我要加载的库存文件的示例:

COFF
12 12 0
-0.4 -4.898587e-17 0.85 158 138 122 255 
-0.4 -4.898587e-17 -0.9 255 0 122 255 
0.4 4.898587e-17 -0.9 0 255 122 255 
0.4 4.898587e-17 0.85 158 138 122 255 
-0.4 -1.2 0.85 158 0 255 255 
-0.4 -1.2 -0.9 158 138 122 255 
0.4 -1.2 -0.9 158 138 122 255 
0.4 -1.2 0.85 158 138 122 255 
-0.4 -1.2 0.85 158 138 122 255 
-0.4 -1.2 -0.9 100 255 0 255 
0.4 -1.2 -0.9 222 0 122 255 
0.4 -1.2 0.85 222 0 122 255 
3 3 1 0
3 3 2 1
3 1 4 0
3 5 4 1
3 2 5 1
3 6 5 2
3 7 2 3
3 7 6 2
3 4 3 0
3 4 7 3
3 9 11 8
3 10 11 9

您可以使用Surface_mesh数据结构,它具有支持COFF文件的read_off((fuction,该文件由操作员>>((调用。 因此,Juste定义了surface_mesh(point_3(,我们称其为 sm,coft file的iStream,我们称其为 is,然后呼叫

is>>sm; 

应该用网格和正确的颜色填充您的Surface_mesh。在您的示例中,颜色将为每个顶点。