简化网格,包括顶点特征。
quad-mesh-simplif的Python项目详细描述
二次网格简化
简化包含节点特征的网格的leightweight包。来自Surface Simplification Using Quadric Error Metrics的算法是用cython实现的。在
安装
有pip
$ pip install quad_mesh_simplify
如果不支持分发,则从源代码
下载此存储库并通过运行以下命令生成包:
^{pr2}$使用
这个软件包提供了一个简化给定网格的简单函数。这可以用于简单网格或具有顶点特征的网格。在
简化网格(位置、面、节点数、特征=无、阈值=0、最大错误=np.无穷大)
positions
(numpy array):包含每个节点的x、y、z位置的形状[num_nodes x3]数组
face
(numpy array):包含每个三角形面的索引的shape[num_faces x 3]数组
num_nodes
(int):最终网格将具有的节点数
threshold(number,可选):要成为有效对的顶点距离的阈值
features
(numpy array):所有节点的功能部件[num_nodes x feature_length]
threshold
(double):如果两个顶点之间的距离低于此阈值,则它们被视为可以合并的有效对。在
max_err
(double):合并的顶点的误差不大于此数字。重要提示:如果提供,则不能保证输出的顶点数少于num_nodes。在
返回:new_positions, new_face, (new_features)
减少简单网格
fromquad_mesh_simplifyimportsimplify_meshnew_positions,new_face=simplify_mesh(positions,face,<final_num_nodes>)
减少具有顶点特征的网格
fromquad_mesh_simplifyimportsimplify_meshnew_positions,new_face=simplify_mesh(positions,face,<final_num_nodes>,features=features)
使用最小距离的阈值减少网格
fromquad_mesh_simplifyimportsimplify_meshnew_positions,new_face=simplify_mesh(positions,face,<final_num_nodes>,threshold=0.5)
- 项目
标签: