我尝试用CGAL将网格中的一些顶点变成红色,并在Meshlab中显示。
我试过了:
Surface_mesh::Property_map<Surface_mesh::Vertex_index, CGAL::Color> vcolors =
mesh.property_map<Surface_mesh::Vertex_index, CGAL::Color >("v:color").first;
std::vector<Surface_mesh::Vertex_index>::iterator v_iter;
for (v_iter = borderVertex.begin(); v_iter != borderVertex.end(); v_iter++)
{
std::cout << *v_iter << " ";
vcolors[*v_iter] = Color(255, 0, 0);
}
虽然颜色已调整为顶点选项,但我在Meshlab中看不到任何红色顶点。 输出 .off 为黑色。
谢谢你,祝你有美好的一天。
请确保颜色存储在.off 导出文件中。您可以通过阅读 .off 文件的第一行来验证这一点,该行应以“COFF”字样开头。
如果文件以“OFF”开头,则颜色信息不在文件中。
另外,请注意 OFF 文件的 RGBA 值是 0 .. 255 范围内的整数,而不是 0.0 .. 1.0 范围内的浮点数。
这里是一个有效的 OFF 文件示例,其中包含可用于测试 meshlab 的逐顶点颜色。
COFF
3 1 0
1220.094 -572.5 77.71394 255 0 0 255
1291.572 -609.4396 28.62849 0 255 0 255
1251.572 -609.4396 38.62849 255 255 255 255
3 0 1 2
如有疑问,我会将文件导出为 .ply 文件格式。