OpenMesh Decimater不会减少顶点数
OpenMesh Decimater does not reduce vertex number
我正在尝试使用OpenMesh抽取一个网格。我遵循了文档中所述的示例:
cout << "Vertices: " << mesh->n_vertices() << endl;
DecimaterT<Mesh> decimater(*mesh); // a decimater object, connected to a mesh
ModQuadricT<Mesh>::Handle hModQuadric; // use a quadric module
decimater.add(hModQuadric); // register module at the decimater
decimater.initialize(); // let the decimater initialize the mesh and the
// modules
decimater.decimate_to(15000); // do decimation
cout << "Vertices: " << decimater.mesh().n_vertices() << endl;
decimate_to方法正确地终止并返回56000,这是应该折叠的顶点数。
然而,我可以从日志中看出,网格上的顶点数没有改变。这怎么可能?
Decimation通过删除元素(顶点、面等)来更改网格的连接性。OpenMesh中网格元素的删除是通过暂时标记各个元素以进行删除来实现的(使用mesh.status(handle).deleted()
属性)。只有当通过调用mesh.garbage_collection()
明确请求时,才会实际删除已删除的元素。在垃圾回收之前,mesh.n_vertices()
的计数中仍然包括标记为删除的顶点。
Decimator不会自动提示垃圾收集;在decimater.decimate_to(...)
之后插入对mesh.garbage_collection()
的调用应该可以解决您的问题。
相关文章:
- 如何循环打印顶点结构
- D3D11-将混合权重和索引传递到顶点着色器
- 从返回的顶点缓冲区查询顶点结构
- Vulkan 中的动态顶点缓冲区格式设置
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- 如何将一半传递给顶点着色器?
- 在 DirectX 11 中从 GPU 读回顶点缓冲区(并获取顶点)
- QT QOpenGLWidget:如何在不使用数据块复制的情况下修改VBO中的单个顶点值?
- 使用 OpenGL 4.5 更改所选顶点的颜色
- Direct3D 11 - HLSL - 获取顶点索引 ID
- 创建异构顶点数据数组的可移植方法
- 使用 glvertex4i 传递网格面索引时的顶点着色器错误
- 无法从 cso 文件创建顶点着色器(从 fx 文件创建)
- OpenGL 相机移动程序顶点着色器问题
- 使用 std::list 存储顶点并使用 SFML 绘制它们
- 为什么顶点数组对象会导致错误?
- 从 CGAL 3D 网格生成中获取顶点坐标的 -6.27744e+66:mesh_implicit_sphere示例
- 将顶点位置从顶点传递到片段着色器 - 仅在使用 Nsight 进行调试时有效
- FBX SDK 在预期 3 个顶点时返回 4 个顶点
- 我对 MyGraph 属性顶点名称和边权重有问题