平滑开放3D网格边缘的算法

平滑开放3D网格边缘的算法

本文介绍了平滑开放3D网格边缘的算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3D网格,它代表一个带有一些我想平滑的粗糙边界的表面:

I have a 3D mesh which represents a surface with some rough boundaries which I would like to smooth:

我正在使用半边数据结构来存储几何图形,因此我可以轻松地迭代边界边,顶点和面.我还可以使用点和叉积轻松确定给定的一对边缘是否为凸/凹.

I am using a half edge data structure for storing the geometry so I can easily iterate over the boundary edges, vertices and faces. I can also quite easily determine whether a given pair of edges is a convex/concave using a dot and cross product.

使边缘平滑的最佳方法是什么,使它们形成连续的弯曲线,而不是图片中看到的清晰图案?

What would be the best approach for smoothing the edges out, so they form a continuous, curvy line, rather then the sharp pattern seen in the pictures?

推荐答案

  1. 计算两个相邻面之间的角度

我称其为ada作为绝对吸收角.如果它大于阈值,则表示该点是边缘.您可以将其计算为所有边线之间的所有角度的max.在 2D 中,它看起来像这样:

I call it ada as abs delta angle. If it is bigger then threshold it means this point is edge. You can compute it as max of all angles between all edge lines. In 2D it looks like this:

3D 网格中,每点多于2条线,因此您必须检查所有组合并选择最大的组合

in 3D mesh there is more then 2 lines per point so you have to check all combinations and select the biggest one

ada=max(abs(acos(n(i).n(j)))

其中n(i),n(j)是相邻面的法线向量,其中i != j

where n(i),n(j) are normal vectors of neighboring faces where i != j

确定有问题的区域

因此在ada > threshold处找到点,并创建这些点的列表

so find points where ada > threshold and create a list of these points

过滤此列表

如果此点与其他任何点(distance>threshold)距离太远,则将其从列表中删除以保留几何形状

if this point is too far from any other (distance>threshold) then remove it from list to preserve geometric shape

平滑点

您必须调整此步骤以满足您的需求,我会这样做:

you have to tweak this step to match your needs I would do this:

在列表中找到一组彼此靠近的点,并在它们上应用一些平均几何或数字,例如:

find a group of points in the list which are close together and apply some averaging geometric or numeric on them for example:

pnt(i)=0.5*pnt(i)+0.25*pnt(i-1)+0.25*pnt(i+1)

可以重复应用

蓝色和红色点是原始点,绿色点是平滑点

blue and red dots are original points, green dots are smoothed points

这篇关于平滑开放3D网格边缘的算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 23:30