[VTK] vtkWindowedSincPolyDataFilter 源码注释解读

vtkWindowedSincPolydataFilter 是 VTK Polydata 的很有用的平滑类。但是这个函数使用的数学理论很多,因此专门分析一下这个类。

1. 参考的论文:

“Optimal Surface Smoothing as Filter Design” G. Taubin, T. Zhang and G. Golub. (Zhang and Golub are at Stanford University

2. 论文下载地址:

https://link.springer.com/content/pdf/10.1007/bfb0015544.pdf

3. VTK 中的注释翻译

This report discusses using standard signal processing low-pass filters (in particular windowed sinc functions) to smooth polyhedra. The
transfer functions of the low-pass filters are approximated by Chebyshev polynomials. This facilitates applying the filters in an
iterative diffusion process (as opposed to a kernel convolution). The more smoothing iterations applied, the higher the degree of polynomial approximating the low-pass filter transfer function. Each smoothing iteration, therefore, applies the next higher term of the Chebyshev filter approximation to the polyhedron. This decoupling of the filter into an iteratively applied polynomial is possible since the Chebyshev polynomials are orthogonal, i.e. increasing the order of the approximation to the filter transfer function does not alter the previously calculated coefficients for the low order terms.

本报告讨论使用标准信号处理低通滤波器 (尤其是加窗的sinc函数)平滑多面体。这个低通滤波器的传递函数近似为切比雪夫多项式。这有助于在迭代扩散过程(与核卷积相反)。这个应用的平滑迭代次数越多,多项式次数越高近似低通滤波器传递函数。每次平滑因此,迭代应用切比雪夫函数的下一个较高项多面体的过滤器近似。
滤波器的解耦由于切比雪夫多项式是正交的,也就是说,增加滤波器传递函数的近似阶数不会改变先前计算的低阶项系数,因此可以将其转换为迭代应用的多项式。

Note: Care must be taken to avoid smoothing with too few iterations. A Chebyshev approximation with too few terms is an poor approximation. The first few smoothing iterations represent a severe scaling and translation of the data. Subsequent iterations cause the smoothed polyhedron to converge to the true location and scale of the object.
We have attempted to protect against this by automatically adjusting the filter, effectively widening the pass band. This adjustment is only
possible if the number of iterations is greater than 1. Note that this sacrifices some degree of smoothing for model integrity. For those
interested, the filter is adjusted by searching for a value sigma such that the actual pass band is k_pb + sigma and such that the
filter transfer function evaluates to unity at k_pb, i.e. f(k_pb) = 1

注意:必须小心避免迭代次数太少而导致平滑。项太少的切比雪夫近似是一种较差的近似。前几个平滑迭代表示严重的缩放和数据的翻译。后续迭代会导致平滑多面体以收敛到对象的真实位置和比例。我们试图通过自动调整滤波器,有效地拓宽了通带。此调整仅限于如果迭代次数大于1,则可能。请注意为了模型的完整性,牺牲了一定程度的平滑。对于那些感兴趣的是,通过搜索值sigma来调整过滤器
实际通带为 k_pb+sigma 滤波器传递函数在 k_pb 处计算为单位,即f(k_pb)=1

To improve the numerical stability of the solution and minimize the scaling the translation effects, the algorithm can translate and scale the position coordinates to within the unit cube [-1, 1], perform the smoothing, and translate and scale the position coordinates back to the original coordinate frame. This mode is controlled with the NormalizeCoordinatesOn() / NormalizeCoordinatesOff() methods. For legacy reasons, the default is NormalizeCoordinatesOff.

为了提高解的数值稳定性并最小化平移效果的缩放,该算法可以将位置坐标平移和缩放到单位立方体[-1,1]内,执行平滑,并将位置坐标平移和缩放回原始坐标系。此模式由NormalizeCoordinationson()控制/NormalizeCoordinatesOff()方法。由于遗留原因,默认
是normalizecoordinationsoff。

This implementation is currently limited to using an interpolation kernel based on Hamming windows. Other windows (such as Hann, Blackman, Kaiser, Lanczos, Gaussian, and exponential windows) could be used instead.
此实现目前仅限于使用插值基于Hamming windows的内核。可以使用其他窗口(如Hann、Blackman、Kaiser、Lanczos、Gaussian和指数窗口)。

There are some special instance variables used to control the execution of this filter. (These ivars basically control what vertices can be smoothed, and the creation of the connectivity array.) The BoundarySmoothing ivar enables/disables the smoothing operation on vertices that are on the “boundary” of the mesh. A boundary vertex is one that is surrounded by a semi-cycle of polygons (or used by a single line).

有一些特殊的实例变量用于控制此过滤器的执行。(这些参数基本上控制哪些顶点可以平滑,以及连接数组的创建。)BoundarySmoothing 参数 启用/禁用网格“边界”上顶点的平滑操作。边界顶点是由多边形的半圆形(或由一条直线使用)包围的顶点。

Another important ivar is FeatureEdgeSmoothing. If this ivar is enabled, then interior vertices are classified as either “simple”, “interior edge”, or “fixed”, and smoothed differently. (Interior vertices are manifold vertices surrounded by a cycle of polygons; or used by two line cells.) The classification is based on the number of feature edges attached to v. A feature edge occurs when the angle between the two surface normals of a polygon sharing an edge is greater than the FeatureAngle ivar. Then, vertices used by no feature edges are classified “simple”, vertices used by exactly two feature edges are classified “interior edge”, and all others are “fixed” vertices.

另一个重要的参数是 FeatureEdgeSmoothing。如果启用此参数,则内部顶点将分类为“简单”、“内部边”或“固定”,并以不同方式进行平滑。(内部顶点是由多边形循环包围的多个顶点;或由两个线单元使用。)分类基于附着到v的特征边的数量。当共享边的多边形的两个曲面法线之间的角度大于特征角度参数时,就会出现特征边。然后,将无特征边使用的顶点分类为“简单”,将正好两条特征边使用的顶点分类为“内部边”,其他所有顶点都是“固定”顶点。

Once the classification is known, the vertices are smoothed differently. Corner (i.e., fixed) vertices are not smoothed at all. Simple vertices are smoothed as before . Interior edge vertices are smoothed only along their two connected edges, and only if the angle between the edges is less than the EdgeAngle 参数.
一旦知道分类,顶点将以不同的方式进行平滑。角点(即固定)顶点根本不会平滑。简单顶点会像以前一样平滑。仅当两条连接边之间的角度小于EdgeAngle 参数时,内部边顶点才会沿其两条连接边进行平滑。

The total smoothing can be controlled by using two ivars. The NumberOfIterations determines the maximum number of smoothing passes. The NumberOfIterations corresponds to the degree of the polynomial that is used to approximate the windowed sinc function. Ten or twenty iterations is all the is usually necessary. Contrast this with vtkSmoothPolyDataFilter which usually requires 100 to 200 smoothing iterations. vtkSmoothPolyDataFilter is also not an approximation to an ideal low-pass filter, which can cause the geometry to shrink as the amount of smoothing increases.

可以使用两个IVAR来控制总平滑。这个NumberOfIterations确定平滑过程的最大数量。NumberOfIterations对应于多项式的次数
用于近似窗口sinc函数。十或二十迭代通常是所有必要的。将此与vtkSmoothPolyDataFilter,通常需要100到200平滑
迭代。vtkSmoothPolyDataFilter也不是理想的低通滤波器,随着平滑量增加,几何体会缩小;

The second ivar is the specification of the PassBand for the windowed sinc filter. By design, the PassBand is specified as a doubleing point number between 0 and 2. Lower PassBand values produce more smoothing. A good default value for the PassBand is 0.1 (for those interested, the PassBand (and frequencies) for PolyData are based on the valence of the vertices, this limits all the frequency modes in a polyhedral mesh to between 0 and 2.)

第二个参数是加窗的sinc滤波器的滤波通带。根据设计,滤波通带被指定为一个双精度浮点类型数字介于0和2之间。通带值越低,平滑度越高。通带的良好默认值为0.1(对于感兴趣的人PolyData的通带(和频率)基于顶点,这将多面体网格中的所有频率模式限制为介于0和2之间。)

There are two instance variables that control the generation of error data. If the ivar GenerateErrorScalars is on, then a scalar value indicating the distance of each vertex from its original position is computed. If the ivar GenerateErrorVectors is on, then a vector representing change in position is computed.

有两个实例变量控制错误的生成数据如果启用了参数 GenerateErrorScalars,则标量值指示计算每个顶点与其原始位置的距离。如果GenerateErrorVectors启用,则表示向量的方式表示计算得到的位置变化。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值