Print

发布时间: 2022-04-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.200596
2022 | Volume 27 | Number 4




    ChinaVR 2020    




  <<上一篇 




  下一篇>> 





带法向约束的隐式T样条曲线重构
expand article info 任浩杰, 寿华好, 莫佳慧, 张航
浙江工业大学理学院,杭州 310023

摘要

目的 隐式曲线能够描述复杂的几何形状和拓扑结构,而传统的隐式B样条曲线的控制网格需要大量多余的控制点满足拓扑约束。有些情况下,获取的数据点不仅包含坐标信息,还包含相应的法向约束条件。针对这个问题,提出了一种带法向约束的隐式T样条曲线重建算法。方法 结合曲率自适应地调整采样点的疏密,利用二叉树及其细分过程从散乱数据点集构造2维T网格; 基于隐式T样条函数提出了一种有效的曲线拟合模型。通过加入偏移数据点和光滑项消除额外零水平集,同时加入法向项减小曲线的法向误差,并依据最优化原理将问题转化为线性方程组求解得到控制系数,从而实现隐式曲线的重构。在误差较大的区域进行T网格局部细分,提高重建隐式曲线的精度。结果 实验在3个数据集上与两种方法进行比较,实验结果表明,本文算法的法向误差显著减小,法向平均误差由10-3数量级缩小为10-4数量级,法向最大误差由10-2数量级缩小为10-3数量级。在重构曲线质量上,消除了额外零水平集。与隐式B样条控制网格相比,3个数据集的T网格的控制点数量只有B样条网格的55.88 %、39.80 %和47.06 %。结论 本文算法能在保证数据点精度的前提下,有效降低法向误差,消除了额外的零水平集。与隐式B样条曲线相比,本文方法减少了控制系数的数量,提高了运算速度。

关键词

离散数据; 隐式曲线; T样条; 曲线重建; 法向约束

Implicit T-spline curve reconstruction with normal constraint
expand article info Ren Haojie, Shou Huahao, Mo Jiahui, Zhang Hang
College of Science, Zhejiang University of Technology, Hangzhou 310023, China
Supported by: National Natural Science Foundation of China (61572430)

Abstract

Objective In computer-aided geometric design and computer graphics, fitting point clouds with the smooth curve is a widely studied problem. Measurement data can be taken from real objects using techniques such as laser scanning, structure light source converter, and X-ray tomography. We use these scanned discrete data points for data fitting to perform a general model reconstruction and functional recovery for the original model or product, which is widely used in the field of geometric analysis and image analysis. The data points used in this paper are unstructured scattered data points. Compared with the parametric curves, implicit curves do not need to parameterize scattered data points. Therefore, they are widely studied because of their ability to describe objects with complicated geometry and topology. Because the control points of the conventional implicit B-spline curve need to be arranged regularly in the entire area, a large number of redundant control points are required to satisfy the topological constraints and has some limitations in the local subdivision, which will lead to the phenomenon of control point redundancy. The T-spline effectively solves this problem. Based on the advantages of B-spline curves and surfaces, it admits the structure of T-nodes, and thus, it has many advantages, such as fewer control points and convenient local subdivision. This is the reason why we chose T-spline to perform the implicit curve reconstruction. In some cases, the data points we obtain may not only be scattered coordinate information but also contain some shape constraint conditions, such as the processing of data points with the normal constraints in the field of optical engineering. Therefore, we not only need to constrain the errors of the data points but also have certain requirements for the normal errors. Hence, an implicit T-spline curve reconstruction algorithm with normal constraints is proposed in this paper. Method We first preprocess the data, which adjusts the density of sampling points adaptively by combining with the curvature to remove the redundant data points and add auxiliary points. The step of adding auxiliary points not only avoids the singular solutions but also helps to eliminate the zero level set. Two-dimensional T-meshes are constructed from the scattered point set by using binary tree and subdivision process. Here, we define a maximum number of subdivisions and then count the number of data points in each sub-rectangular block. If the number of data points is greater than the given number of subdivisions, it is subdivided until the number of data points is less than the maximum number of subdivisions and we obtain the initial T-mesh. Then, an effective curve fitting model is proposed based on the implicit T-spline function. Because the number of equations is far more than the number of unknowns, we transform the problem of the implicit T-spline curve reconstruction into a quadratic optimization problem to obtain the objective function. The objective function of our model is divided into three parts: the fitting error term, normal term, and smoothing term. The fitting error term includes the error of data points and auxiliary points. We eliminate the extra zero-level sets by adding offset points and smoothing the term. We also add the normal term to reduce the normal error of the constructed curve. According to the optimization principle, we take the partial derivative of the objective function concerning each of the control coefficients and set it equal to zero. In this case, the original problem is transformed into linear equations. The unknown control coefficients can be obtained by solving the system of linear equations to solve the problem of implicit curve reconstruction. Finally, we insert the control coefficient into the area of the large error to carry out the local subdivision of T-mesh until the precision requirement is reached to improve the accuracy of the reconstruction of the implicit curve. Result The experiment is compared with two existing methods on three datasets, including two concave and convex curves and a complicated hand curve. From the figures in paper, we can see that although the proposed method and the existing method 1 which contructs implicit equations with normal vector constraints, reconstruct the shape of the implicit T-spline curve, some extra zero level sets appear around the curve of method 1, which destroy the quality of the reconstructed curves. The reconstructed results of the proposed method do not have the extra zero level set. The experimental data show that in terms of the error of the data points, the algorithm presented in this paper differs little from the two methods in terms of the average error and the maximum error of data points, which are in the same order of magnitude. However, in the normal error, the proposed algorithm has a significant reduction. In the curves of examples 1 and 2, the proposed algorithm reduces the average error of the normal direction from the order of 10-3 to the order of 10-4 and the maximum error of the normal direction from the order of 10-2 to the order of 10-3. Meanwhile, in the curve of example 3, the proposed algorithm can still significantly reduce the normal error while method 2 which uses least square fitting method by adding auxiliarg points, has the worst normal constraint. In terms of the quality of the reconstructed curve, the extra zero level set is eliminated by the proposed method while the obvious zero level set exists in method 1 and the reconstruction effect is poor. Meanwhile, compared with the implicit B-spline control grid, the number of control points in the T-mesh of the three data sets was only 55.88 %, 39.80 %, and 47.06 % of that in the B-spline grid. Conclusion Experimental results indicate that the proposed algorithm effectively reduces the normal errors under the premise of ensuring the accuracy of data points. The proposed algorithm also successfully eliminates extra zero-level sets and improves the quality of the reconstructed curve. Compared with the implicit B-spline curves, the proposed method reduces the number of control coefficients and improves the operation speed. Hence, the proposed method successfully solves the problem of implicit T-spline curve reconstruction with normal constraints.

Key words

discrete data; implicit curve; T-spline; curve reconstruction; normal constraints

0 引言

在计算机辅助几何设计和计算机图形学中,采用光滑曲线拟合点云是一个广泛研究的问题(Várady等,1997)。通过激光扫描、X射线断层成像等先进采样设备获取测量数据,并对其进行数据拟合,可以实现对原模型进行大致的重建及功能恢复。但有些情况下,获取的数据点不仅是散乱的坐标信息,还包含一些约束形状的条件,如光学工程领域对带有法向约束的数据点的处理(胡巧莉和寿华好,2014; 胡良臣和寿华好,2016)。

与参数曲线相比,隐式曲线不需要对散乱数据点进行参数化就可以描述具有复杂集合形状的对象。传统的基于B样条的隐式曲线重构已有了一系列高效、快速和稳定的算法(Yang等,2005; Liu等,2017; Hamza等,2020)。Yang等人(2005)提出了一种基于B样条的隐式曲线重构模型,能够处理具有复杂拓扑结构的点云。Hamza等人(2020)将渐进迭代逼近法应用于隐式B样条曲线和曲面重建,提高了重建结果的质量,但是由于隐式B样条曲线的控制网格的控制顶点需要整行整列地规则排列,使得在局部细分方面存在一定的局限性,会造成控制点冗余现象。Sederberg等人(2003, 2004)提出了T样条方法,允许出现T节点,在继承B样条曲面优点的基础上,又增加了控制点较少、局部细分等优势,是一项很有前途的技术,在逆向工程等领域得到了广泛研究。在T样条拟合方面,Zheng等人(2005)首先提出了在z-map条件下的T样条曲面重构。Wang和Zheng(2007, 2013)将三角网格转化为T样条曲面,并提出了曲率引导下的T样条拟合方法。童伟华等人(2006)提出了隐式T样条曲面,将T网格从2维推广至3维,实现了曲面重构。唐月红等人(2011)提出一种新的隐式T样条曲面重建算法。近年来,一些快速拟合T样条的方法相继提出。Lin(2012)Lin和Zhang(2013)将渐进T样条数据拟合算法用于拟合大数据集,迭代速度稳定,且不受未知T网格顶点数量增加的影响。Lu等人(2020)提出了基于区域分割的T样条拟合方法。

基于上述有关T样条的研究,本文将T样条函数应用于曲线重构问题,提出了一种带法向约束的隐式T样条曲线重构算法。通过结合曲率自适应地调整了采样点的疏密程度,利用加入曲线偏移点和光滑项消除额外零水平集,同时加入法向项约束曲线的法向方向,初步得到一条隐式T样条曲线。同时,优化了局部细分的算法,对曲线进行局部修正,在降低曲线误差的前提下,减少了插入控制系数的数量,最终得到一条满足数据点和法向约束的隐式T样条曲线。

1 隐式T样条曲线重建算法描述

1.1 隐式T样条曲线方程

若隐式曲线通过隐函数$f: \boldsymbol{\varOmega} \subset \mathbf{R}^{2} \rightarrow \mathbf{R}$,则称$\boldsymbol{S}=f^{-1}(0)=\{p \in \boldsymbol{\varOmega}; f(p)=0\}$ 为隐式曲线。若函数$ f$为T样条函数,则隐式曲线$\boldsymbol{S} $称为隐式T样条曲线。

定义在2维T网格上的隐式T样条曲线方程为

$ f(x, y)=\frac{\sum\limits_{i=1}^{m} c_{i} B_{i}(x, y)}{\sum\limits_{i=1}^{m} B_{i}(x, y)}=0,(x, y) \in \boldsymbol{\varOmega} $ (1)

式中,$c_{i}$是控制系数。控制系数$c_{i}$对应的T样条基函数$B_{i}(x, y)$

$ B_{i}(x, y)=N\left[\boldsymbol{s}_{i}\right](x) N\left[\boldsymbol{t}_{i}\right](y) $ (2)

式中,$N\left[\boldsymbol{s}_{i}\right](x)$$N\left[\boldsymbol{t}_{i}\right](y)$是三次B样条基函数,相应的节点向量为$\boldsymbol{s}_{i}=\left[s_{i 0}, s_{i 1}, \cdots, s_{i 4}\right]$$\boldsymbol{t}_{i}=\left[t_{i 0}, t_{i 1}, \cdots, t_{i 4}\right]$。此时,$N\left[\boldsymbol{s}_{i}\right](x)$可表示为

$ \begin{array}{c} N\left[\boldsymbol{s}_{i}\right](x)= \\ \begin{cases}\frac{1}{a_{0}} A_{0}(x) & x \in\left[s_{i 0}, s_{i 1}\right) \\ \frac{1}{b_{0}} B_{0}(x)+\frac{1}{b_{1}} B_{1}(x)+\frac{1}{b_{2}} B_{2}(x) & x \in\left[s_{i 1}, s_{i 2}\right) \\ \frac{1}{c_{0}} C_{0}(x)+\frac{1}{c_{1}} C_{1}(x)+\frac{1}{c_{2}} C_{2}(x) & x \in\left[s_{i 2}, s_{i 3}\right) \\ \frac{1}{d_{0}} D_{0}(x) & x \in\left[s_{i 3}, s_{i 4}\right) \\ 0 & \text { 其他 }\end{cases} \end{array} $

式中,

$ \left\{\begin{array}{l} a_{0}=\left(s_{i 1}-s_{i 0}\right)\left(s_{i 2}-s_{i 0}\right)\left(s_{i 3}-s_{i 0}\right) \\ b_{0}=-\left(s_{i 2}-s_{i 1}\right)\left(s_{i 3}-s_{i 0}\right)\left(s_{i 2}-s_{i 0}\right) \\ b_{1}=-\left(s_{i 2}-s_{i 1}\right)\left(s_{i 3}-s_{i 1}\right)\left(s_{i 3}-s_{i 0}\right) \\ b_{2}=-\left(s_{i 2}-s_{i 1}\right)\left(s_{i 4}-s_{i 1}\right)\left(s_{i 3}-s_{i 1}\right) \\ c_{0}=\left(s_{i 3}-s_{i 2}\right)\left(s_{i 3}-s_{i 1}\right)\left(s_{i 3}-s_{i 0}\right) \\ c_{1}=\left(s_{i 3}-s_{i 2}\right)\left(s_{i 4}-s_{i 1}\right)\left(s_{i 3}-s_{i 1}\right) \\ c_{2}=\left(s_{i 3}-s_{i 2}\right)\left(s_{i 4}-s_{i 2}\right)\left(s_{i 4}-s_{i 1}\right) \\ d_{0}=-\left(s_{i 4}-s_{i 3}\right)\left(s_{i 4}-s_{i 2}\right)\left(s_{i 4}-s_{i 1}\right) \end{array}\right. $

$ \left\{\begin{array}{l} A_{0}(x)=\left(x-s_{i 0}\right)^{3} \\ B_{0}(x)=\left(x-s_{i 0}\right)^{2}\left(x-s_{i 2}\right) \\ B_{1}(x)=\left(x-s_{i 0}\right)\left(x-s_{i 1}\right)\left(x-s_{i 3}\right) \\ B_{2}(x)=\left(x-s_{i 1}\right)^{2}\left(x-s_{i 4}\right) \\ C_{0}(x)=\left(x-s_{i 0}\right)\left(x-s_{i 3}\right)^{2} \\ C_{1}(x)=\left(x-s_{i 1}\right)\left(x-s_{i 3}\right)\left(x-s_{i 4}\right) \\ C_{2}(x)=\left(x-s_{i 2}\right)\left(x-s_{i 4}\right)^{2} \\ D_{0}(x)=\left(x-s_{i 4}\right)^{3} \end{array}\right. $

由式(1)确定的二元函数$f(x, y)$称为隐式T样条函数,由$f^{-1}(0)$定义的曲线称为隐式T样条曲线。

1.2 曲线重建算法

给定$n$ 个2维空间中的散乱数据点集$\boldsymbol{P}= \left\{\boldsymbol{p}_{i}=\left(x_{i}, y_{i}\right), i=1, 2, \cdots, n\right\}$, 且每个数据点带有一个有向的单位法向量$\boldsymbol{N}=\left\{\boldsymbol{n}_{i}, i=1, 2, \cdots, n\right\}$,现在需要找到一条隐式T样条曲线$f(x, y)$=0逼近给定的数据点且对于数据点在曲线上的对应位置满足法向约束条件,即$f\left(x_{i}, y_{i}\right)=0$$\nabla f\left(x_{i}, y_{i}\right)= \boldsymbol{n}_{i}, i=1, 2, \cdots, n$。为了避免平凡解$ f$=0,在数据点集中加入一些额外的偏移点作为辅助点$\left\{\boldsymbol{p}_{l}=\right. \left.\left(x_{l}, y_{l}\right), l=n+1, n+2, \cdots, N\right\}$。假定$d_{l}$为偏移点$\boldsymbol{p}_{l}$到曲线上最近点$\boldsymbol{p}_{k}$的有向距离,即$\boldsymbol{p}_{l}=\boldsymbol{p}_{k}+d_{l} \boldsymbol{n}_{k}$,此时隐函数在偏移点处的方程为

$ f\left(x_{l}, y_{l}\right)=d_{l}, l=n+1, n+2, \cdots, N $ (3)

$\boldsymbol{v}_{i}$表示曲线在$\boldsymbol{p}_{i}$处的单位切向量,显然

$ \boldsymbol{v}_{i} \cdot \boldsymbol{n}_{i}=0, i=1,2, \cdots, n $

由此可以得到$n$ 个单位切向量$\boldsymbol{v}_{i}$的值。于是问题转化为要求函数$ f$满足

$ \begin{cases}f\left(x_{i}, y_{i}\right)=0 & i=1,2, \cdots, n \\ f\left(x_{i}, y_{i}\right)=d_{i} \neq 0 & i=n+1, n+2, \cdots, N \\ \nabla f\left(x_{i}, y_{i}\right) v_{i}=0 & i=1,2, \cdots, n\end{cases} $ (4)

隐式T样条曲线重构算法步骤如下:

输入:散乱数据点集$\boldsymbol{p}_{i}$和对应的单位法向量$\boldsymbol{n}_{i}, i=1, 2, \cdots, n$

输出:T网格和网格点对应的控制系数。

1) 对输入的数据进行预处理,通过曲率自适应调整采样点的疏密程度,利用单位法向量加入偏移点作为辅助点,同时求出每个数据点的单位切向量。

2) 利用二叉树对数据点进行细分,自动生成合理的2维T网格。给T网格的每条边赋予一个节点区间值,同时给T网格的边界加入相应的虚边, 并给虚边赋予一个非负值。

3) 利用T网格获取网格上每个点的局部坐标系,从而得到每个控制系数对应的节点向量,进而得到T样条基函数。

4) 建立合适的优化模型,并用最小二乘法求得T样条的控制系数,获得隐式T样条曲线。

5) 对得到的隐式T样条曲线与给定的数据点集和单位法向量进行分析,判断是否达到精度要求。在误差较大的区域插入新的控制系数进行修正,然后更新节点向量,转步骤4),直到满足精度要求。

2 构造2维T网格

将隐式T样条应用到曲线重建的关键问题是构造合理的2维T网格,使其控制系数满足一定的拓扑关系。

T样条是允许出现T节点的矩形网格,控制网格的顶点不要求整行整列的排列,因此构造T网格可以在数据点密集的地方多插入控制系数,在数据点稀疏的地方少插入控制系数,使T网格的网格点的数量相比B样条的控制网格大幅减少,在保证类似精度的前提下提高了重建曲线的效率。在2维平面上利用二叉树方法进行细分的步骤如下:

1) 定义一个细分的最大次数和一个阈值,其中,阈值表示每个矩形块中允许包含的最大点数。

2) 计算每个矩形块中包含的数据点数量,若某个矩形块包含的数据点个数大于给定的阈值,则对其进行细分。具体来说,假定该矩形块的左下角坐标为$\left(s_{\text {min }}, t_{\min }\right)$,右上角坐标为$\left(s_{\max }, t_{\max }\right)$,T网格$ s$方向的长度为$s_{m}, t$方向的长度为$t_{m} $。如果$\left(s_{\max }-\right.$ $\left.s_{\text {min }}\right) / s_{m} \geqslant\left(t_{\text {max }}-t_{\text {min }}\right) / t_{m}$,那么在矩形块$s= \left[\left(s_{\text {max }}+s_{\text {min }}\right) / 2\right]$ 处将矩形块分成两块; 否则,在$t= [\left.\left(t_{\max }+t_{\min }\right) / 2\right]$ 处细分矩形块。

3) 重复步骤2),直到每个矩形块包含的点数小于阈值或者达到最大的细分次数。

4) 输出细分后得到的T网格。

通过细分得到的T网格,不仅要保存T网格每个顶点的坐标,还需要通过节点区间值得到每个顶点对应的局部坐标系。

图 1是由一条封闭曲线构造的T网格。其中图 1(a)是曲线的初始采样点,包含466个数据点,图 1(b)是通过平面二叉树细分生成的2维T网格,包含131个网格点。

图 1 2维T网格构造
Fig. 1 The construction of two dimensional T-meshes
((a) the initial sampling points; (b) two dimensional T-meshes)

构造2维T网格后,因为每个控制系数$c_{i}$都对应T网格上的各个网格顶点,因此可以得到控制系数$c_{i}$的数量。然后通过T网格获得每个控制系数对应的节点向量$\boldsymbol{s}_{i}$$\boldsymbol{t}_{i}$,从而确定控制系数的基函数。本文在构造T网格后,保存了网格顶点、边、节点区间值以及每个小矩形块的信息,以便对T网格进行局部修正。

3 模型拟合

通过T网格构造,得到每个控制系数对应的基函数后,尚需找到合适的隐式T样条函数$ f$满足式(4)中的条件。显然,待求的未知数即控制系数的数量远少于条件中给出的方程的个数,因此需要建立合适的优化模型,从而找到在某种意义下的最优解。此时,隐式曲线重构问题转化为最小值优化问题,得到的目标方程为

$ E_{\mathrm{fit}}(\boldsymbol{c})=E_{p}(\boldsymbol{c})+\omega_{1} E_{N}(\boldsymbol{c})+\omega_{2} E_{G}(\boldsymbol{c}) $ (5)

式中,$\boldsymbol{c}=\left[c_{1}, c_{2}, \cdots, c_{m}\right]^{\mathrm{T}}$为T网格中待求的控制系数,$E_{p}(\boldsymbol{c})$表示拟合误差平方和; $E_{N}(\boldsymbol{c})$表示法向项,$\omega_{1}$为法向项权值; $E_{G}(\boldsymbol{c})$表示光滑项,$\omega_{2}$为光滑项系数。这里,$E_{p}(\boldsymbol{c})$可以表示为

$ \begin{aligned} E_{p}(\boldsymbol{c})=& \sum\limits_{j=1}^{n}\left[f\left(\boldsymbol{p}_{j}\right)\right]^{2}+\sum\limits_{j=n+1}^{N}\left[f\left(\boldsymbol{p}_{j}\right)-d_{j}\right]^{2}=\\ & \boldsymbol{c}^{\mathrm{T}} \boldsymbol{L}^{\mathrm{T}} \boldsymbol{L} \boldsymbol{c}-2 \boldsymbol{c}^{\mathrm{T}} \boldsymbol{H}+\sum\limits_{j=n+1}^{N} d_{i}^{2} \end{aligned} $

式中,矩阵$\boldsymbol{L}=\left(l_{s t}\right)_{N \times m}, l_{s t}$表示为$B_{t}\left(x_{s}, y_{s}\right)$$\boldsymbol{H}$是一个$m \times 1$的向量,它的每一项$h_{i}=\sum\limits_{j=n+1}^{N} d_{j} B_{i}\left(x_{j}\right., \left.y_{j}\right), i=1, 2, \cdots, m$

$E_{N}(\boldsymbol{c})$可以表示为

$ \begin{gathered} E_{N}(\boldsymbol{c})=\sum\limits_{j=1}^{n}\left[\nabla f\left(\boldsymbol{p}_{j}\right) \cdot \boldsymbol{v}_{j}\right]^{2}= \\ \sum\limits_{j=1}^{n}\left[f_{x}\left(\boldsymbol{p}_{j}\right) \cdot v_{j x}+f_{y}\left(\boldsymbol{p}_{j}\right) \cdot v_{j y}\right]^{2}= \\ \boldsymbol{c}^{\mathrm{T}} \boldsymbol{A}_{x}^{\mathrm{T}} \boldsymbol{A}_{x} \boldsymbol{c}+2 \boldsymbol{c}^{\mathrm{T}} \boldsymbol{A}_{x}^{\mathrm{T}} \boldsymbol{A}_{y} \boldsymbol{c}+\boldsymbol{c}^{\mathrm{T}} \boldsymbol{A}_{y}^{\mathrm{T}} \boldsymbol{A}_{y} \boldsymbol{c} \end{gathered} $

式中,$\nabla f$表示函数$ f$的梯度,$ f_x$$ f_y$分别表示函数$ f$$x$$y$求偏导数,$\boldsymbol{v}_{j}=\left(v_{j x}, v_{j y}\right)^{\mathrm{T}}$为数据点$\boldsymbol{p}_{j}$对应的单位切向量。而矩阵$\boldsymbol{A}_{x}=\left(a_{x}\right)_{n \times m}, \boldsymbol{A}_{y}= \left(a_{y}\right)_{n \times m}$,其中,矩阵$\boldsymbol{A}_x$的元素为$\left(a_{x}\right)_{s t}= \frac{\partial B_{t}\left(x_{s}, y_{s}\right)}{\partial x} v_{t x}, \boldsymbol{A}_{y}$的元素为$\left(a_{y}\right)_{s t}=\frac{\partial B_{t}\left(x_{s}, y_{s}\right)}{\partial y} v_{t y}$, $s=1, 2, \cdots, n, t=1, 2, \cdots, m$

$E_{G}(\boldsymbol{c})$可以表示为

$ \begin{gathered} E_{G}(\boldsymbol{c})=\sum\limits_{j=1}^{n}\left[f_{x x}^{2}\left(x_{j}, y_{j}\right)+2 f_{x y}^{2}\left(x_{j}, y_{j}\right)+\right. \\ \left.f_{y y}^{2}\left(x_{j}, y_{j}\right)\right]= \\ \boldsymbol{c}^{\mathrm{T}} \boldsymbol{O}^{\mathrm{T}} \boldsymbol{O} \boldsymbol{c}+2 \boldsymbol{c}^{\mathrm{T}} \boldsymbol{P}^{\mathrm{T}} \boldsymbol{P} \boldsymbol{c}+\boldsymbol{c}^{\mathrm{T}} \boldsymbol{Q}^{\mathrm{T}} \boldsymbol{Q} \boldsymbol{c} \end{gathered} $

式中,$ f_{xx}$$ f_{yy}$分别表示函数$ f$$x$$y$求二次偏导数,$ f_{xy}$表示函数$ f$的二阶混合偏导数。矩阵$\boldsymbol{O}= \left(o_{s t}\right)_{n \times m}, \boldsymbol{P}=\left(p_{s t}\right)_{n \times m}, \boldsymbol{Q}=\left(q_{s t}\right)_{n \times m}$,3个矩阵中的元素分别为$o_{s t}=\frac{\partial^{2} B_{t}\left(x_{s}, y_{s}\right)}{\partial x^{2}}, p_{s t}=\frac{\partial^{2} B_{t}\left(x_{s}, y_{s}\right)}{\partial x \partial y}$, $ q_{s t}=\frac{\partial^{2} B_{t}\left(x_{s}, y_{s}\right)}{\partial y^{2}}, s=1, 2, \cdots, n, t=1, 2, \cdots, m $

为了求解优化问题,将式(5)的目标函数对控制系数c的每个分量求偏导,并使其等于零,即

$ \frac{\partial E_{\mathrm{fit}}(\boldsymbol{c})}{\partial c_{k}}=0, k=1,2, \cdots, m $ (6)

此时,问题转化为求解

$ \begin{gathered} {\left[\boldsymbol{L}^{\mathrm{T}} \boldsymbol{L}+\omega_{1}\left(\boldsymbol{A}_{x}^{\mathrm{T}} \boldsymbol{A}_{x}+\boldsymbol{A}_{x}^{\mathrm{T}} \boldsymbol{A}_{y}+\boldsymbol{A}_{y}^{\mathrm{T}} \boldsymbol{A}_{x}+\boldsymbol{A}_{y}^{\mathrm{T}} \boldsymbol{A}_{y}\right)+\right.} \\ \left.\omega_{2}\left(\boldsymbol{O}^{\mathrm{T}} \boldsymbol{O}+\boldsymbol{P}^{\mathrm{T}} \boldsymbol{P}+\boldsymbol{Q}^{\mathrm{T}} \boldsymbol{Q}\right)\right] \boldsymbol{c}=\boldsymbol{H} \end{gathered} $ (7)

解该线性方程组即可得到T网格中控制系数的值,从而得到隐式T样条曲线。

4 T网格局部细分

通过拟合模型得到一条隐式T样条曲线后,对拟合结果进行检测。采用$\Delta_{p_{i}}=\frac{\left|f\left(\boldsymbol{p}_{i}\right)\right|}{\left\|\nabla f\left(\boldsymbol{p}_{i}\right)\right\|}$ 计算每个采样点$\boldsymbol{p}_{i}$的拟合误差,用$\Delta_{n i}= \arccos \left(\frac{\nabla f\left(\boldsymbol{p}_{i}\right) \cdot \boldsymbol{n}_{i}}{\left\|\nabla f\left(\boldsymbol{p}_{i}\right)\right\|}\right)$ 计算隐式T样条曲线在采样点$\boldsymbol{p}_{i}$处的法向与给定的法向约束的误差,此时$\Delta_{i}= \Delta_{p_{i}}+\lambda \cdot \Delta_{n i}$表示曲线在$\boldsymbol{p}_{i}$处的总误差,其中$ \lambda $表示数据点误差和法向误差之间的权重关系。局部细分算法的具体步骤如下:

1) 给定一个容许误差$ \sigma $>0,细分比率$\alpha $和一个阈值$z$,这里的阈值小于上面构造T网格时给定的阈值。

2) 计算每个采样点$\boldsymbol{p}_{i}$对应的误差$\Delta_{i}$,若所有采样点的误差均小于容许误差$ \sigma $,则此时的隐式T样条曲线即为最终的曲线,循环终止; 否则,找到误差不满足的采样点处于哪些矩阵块后,执行步骤3)。

3) 计算需要细分的矩形块中包含的数据点的数量,若某矩形块的数据点数量小于给定阈值$z$,则将该矩形块排除需要细分的序列。

4) 统计需要细分的矩形块的总数量,与细分比率$\alpha $相乘,得到的值μ即为实际细分的数量。根据矩形块包含数据点的最大误差对矩形块从大到小进行排序,此时,对前μ个矩形块细分。

5) 更新T样条基函数,重新反求控制系数,得到新的隐式T样条曲线。

6) 重复步骤2)—5),直到循环结束,输出T网格和相应的控制系数。

5 实验与比较

选取3个封闭曲线实例对隐式T样条曲线重建算法的性能进行验证。首先结合曲率自适应地调整采样点的疏密程度,然后进行曲线重构。现有的T样条重构的方法大多集中在曲面上,实验时,选取童伟华等人(2006)唐月红等人(2011)的隐式T样条曲面重构方法用于隐式T样条曲线重建,分别作为方案1和方案2,其中,方案1通过添加隐函数对$x$, $y$求偏导分别等于法向分量的方程避免奇异解,重构隐式T样条函数; 方案2通过添加偏移点构造隐式函数。然后将两种方案与本文算法进行比较,以验证本文方法的性能。图 2展示了方案1和本文方法对3条曲线的重建,其中,图 2(a)是初始采样点显示的曲线,图 2(b)是构造的2维T网格,图 2(c)图 2(d)分别为方案1和本文方法重构的曲线。可以看出,虽然本文方法和方案1都重构出了隐式T样条曲线,但是方案1的方法会产生一些额外的零水平集,破坏了重构效果。

图 2 方案1和本文方法对3条曲线的重建
Fig. 2 The reconstruction of three curves using the method 1 and the proposed method
((a) the initial sampling points; (b) two dimensional T-meshes; (c) method 1;(d) ours)

本文方法与方案1和方案2的定量比较结果如表 1所示。可以看出,3种方法在数据点处的误差相差不大,但是本文方法在法向误差处无论是平均误差还是最大误差都是最小的。方案1虽然也能约束法向,但是误差没有本文方法小,同时会产生零水平集。方案2重构曲率变化较小的曲线时,法向误差与方案1差不多,但在实现曲率变化较大的曲线,如曲线3的手型曲线时不能有效地约束法向,法向误差较大。本文对输入的数据点要求采样密集,当数据点比较稀疏时,对曲线1这种比较简单的曲线影响不大,但对比较复杂的曲线在曲率变化较大的位置无法较好地约束法向误差。

表 1 不同方法重构曲线误差比较
Table 1 The comparison of the curve errors between different methods

下载CSV
方法 曲线1 曲线2 曲线3
数据点误差 法向误差 数据点误差 法向误差 数据点误差 法向误差
平均误差 最大误差 平均误差 最大误差 平均误差 最大误差 平均误差 最大误差 平均误差 最大误差 平均误差 最大误差
方案1 1.44×10-4 1.09×10-3 4.28×10-3 2.55×10-2 8.15×10-5 1.15×10-3 3.42×10-3 2.96×10-2 7.1×10-4 7.37×10-3 1.80×10-3 3.23×10-2
方案2 4.90×10-5 1.32×10-3 2.5×10-3 3.94×10-2 1.28×10-4 1.22×10-3 3.49×10-3 3.92×10-2 4.42×10-4 8.07×10-3 1.86×10-2 2.12×10-1
本文 4.24×10-5 2.85×10-4 1.57×10-4 4.13×10-3 7.26×10-5 7.70×10-4 5.69×10-4 5.33×10-3 6.48×10-4 7.91×10-3 4.72×10-4 4.76×10-3
注:加粗字体表示法向误差最优结果。

在网格顶点数量方面,隐式B样条需要大量多余的控制点来满足拓扑约束,而隐式T样条曲线可以大幅减少多余的网格点的数量。表 2给出了3条曲线关于B样条网格与T网格顶点数的比较,其中包括每个曲线采样的数据点数、网格在两个方向上的节点数以及控制顶点数。可以看出,3条曲线的T网格顶点数均小于B样条控制点数,从而大幅减少了运算量。

表 2 B样条控制顶点数与T网格顶点数的比较
Table 2 The comparison of the quantities of control points between B-spline and T-spline

下载CSV
曲线 数据点数 $ s$方向节点数 t方向节点数 控制点数
B样条网格 T网格
1 281 14 17 238 133
2 593 17 30 510 203
3 726 17 31 527 248
注:加粗字体表示本文算法的网格顶点数。

6 结论

本文针对带有法向约束的离散数据点集提出了一种有效的隐式T样条曲线重建算法,较好地实现了3个封闭曲线实例的重建。实验结果表明,通过加入曲线偏移点作为辅助点和在拟合模型中加入光滑项,本文方法成功消除了额外零水平集,提高了重构曲线的质量。此外,通过在模型中加入法向项约束,重构的曲线会在逼近数据点的同时满足数据点处的法向约束。本文还优化了局部细分的算法,引入了细分比率这一概念,减少了插入控制系数的数量,提高了运算速度。本文将两种隐式T样条曲面重构的方法应用到曲线重构上,然后与本文的隐式T样条曲线重构方法进行比较。可以发现,在数据点误差精度相差不大的情况下,本文方法在法向误差精度上有了显著提高,而法向误差在光学反射曲线曲面设计等领域有着重要作用。本文将隐式T样条曲线的网格与隐式B样条的网格顶点数量进行比较,在两种控制网格的相同位置插入控制点时,由于隐式B样条曲线的网格需要大量多余的控制点来满足拓扑约束,实验结果显示,隐式T样条的网格顶点数只有B样条网格的一半左右。

总之,实验数据和重建的效果图显示,本文方法较好地解决了带法向约束的隐式T样条曲线重建问题。但本文方法仍有不足之处: 1)本文方法在重建不光滑的曲线如心形线时,在尖锐点的附近无法对法向进行有效约束,有较大的误差; 2)本文方法对数据点要求密集,若数据点比较稀疏,则在曲线曲率变化较大的位置将无法较好地约束法向误差。有待进一步研究。

参考文献

  • Hamza Y F, Lin H W, Li Z H. 2020. Implicit progressive-iterative approximation for curve and surface reconstruction. Computer Aided Geometric Design, 77: #101817 [DOI:10.1016/j.cagd.2020.101817]
  • Hu L C, Shou H H. 2016. Particle swarm optimization algorithm for B-spline curve approximation with normal constraint. Journal of Computer-Aided Design and Computer Graphics, 28(9): 1443-1450 (胡良臣, 寿华好. 2016. PSO求解带法向约束的B样条曲线逼近问题. 计算机辅助设计与图形学学报, 28(9): 1443-1450) [DOI:10.3969/j.issn.1003-9775.2016.09.006]
  • Hu Q L, Shou H H. 2014. Cubic uniform B-spline curves interpolation with normal constrains. Journal of Zhejiang University (Science Edition), 41(6): 619-623 (胡巧莉, 寿华好. 2014. 带法向约束的3次均匀B样条曲线插值. 浙江大学学报(理学版), 41(6): 619-623) [DOI:10.3785/j.issn.1008-9497.2014.06.002]
  • Lin H W. 2012. Adaptive data fitting by the progressive-iterative approximation. Computer Aided Geometric Design, 29(7): 463-473 [DOI:10.1016/j.cagd.2012.03.005]
  • Lin H W, Zhang Z Y. 2013. An efficient method for fitting large data sets using T-splines. SIAM Journal on Scientific Computing, 35(6): A3052-A3068 [DOI:10.1137/120888569]
  • Liu Y, Song Y Z, Yang Z W, Deng J S. 2017. Implicit surface reconstruction with total variation regularization. Computer Aided Geometric Design, 52-53: 135-153 [DOI:10.1016/j.cagd.2017.02.005]
  • Lu Z H, Jiang X, Huo G Y, Ye D L, Wang B L, Zheng Z M. 2020. A fast T-spline fitting method based on efficient region segmentation. Computational and Applied Mathematics, 39(2): #55 [DOI:10.1007/s40314-020-1071-6]
  • Sederberg T W, Cardon D L, Finnigan G T, North N S, Zheng J M, Lyche T. 2004. T-spline simplification and local refinement. ACM Transactions on Graphics, 23(3): 276-283 [DOI:10.1145/1015706.1015715]
  • Sederberg T W, Zheng J M, Bakenov A, Nasri A. 2003. T-splines and T-NURCCs. ACM Transactions on Graphics, 22(3): 477-484 [DOI:10.1145/882262.882295]
  • Tang Y H, Li X J, Cheng Z M, Qian M F. 2011. Closed surface reconstruction based on implicit T-splines. Journal of Computer-Aided Design and Computer Graphics, 23(2): 270-275 (唐月红, 李秀娟, 程泽铭, 钱明凤. 2011. 隐式T样条实现封闭曲面重建. 计算机辅助设计与图形学学报, 23(2): 270-275)
  • Tong W H, Feng Y Y, Chen F L. 2006. A surface reconstruction algorithm based on implicit T-spline surfaces. Journal of Computer-Aided Design and Computer Graphics, 18(3): 358-365 (童伟华, 冯玉瑜, 陈发来. 2006. 基于隐式T样条的曲面重构算法. 计算机辅助设计与图形学学报, 18(3): 358-365) [DOI:10.3321/j.issn:1003-9775.2006.03.006]
  • Várady T, Martin R R, Cox J. 1997. Reverse engineering of geometric models——an introduction. Computer-Aided Design, 29(4): 255-268 [DOI:10.1016/S0010-4485(96)00054-1]
  • Wang Y M and Zheng J M. 2007. Adaptive T-spline surface approximation of triangular meshes//Proceedings of the 6th International Conference on Information, Communications and Signal Processing. Singapore, Singapore: IEEE: 1-5 [DOI: 10.1109/ICICS.2007.4449775]
  • Wang Y M, Zheng J M. 2013. Curvature-guided adaptive T-spline surface fitting. Computer-Aided Design, 45(8/9): 1095-1107 [DOI:10.1016/j.cad.2013.04.006]
  • Yang Z W, Deng J S, Chen F L. 2005. Fitting unorganized point clouds with active implicit B-spline curves. The Visual Computer, 21(8/10): 831-839 [DOI:10.1007/s00371-005-0340-0]
  • Zheng J M, Wang Y M and Seah H S. 2005. Adaptive T-spline surface fitting to z-map models//Proceedings of the 3rd International Conference on Computer Graphics and Interactive Techniques in Australasia and South East Asia. Dunedin, New Zealand: ACM: 405-411 [DOI: 10.1145/1101389.1101468]