Print

发布时间: 2021-10-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.200485
2021 | Volume 26 | Number 10




    计算机图形学    




  <<上一篇 




  下一篇>> 





利用距离与内能极小平滑链接Bézier曲线
expand article info 李军成, 刘成志, 刘珊君
湖南人文科技学院数学与金融学院, 娄底 417000

摘要

目的 对于满足低阶连续的链接Bézier曲线,提高曲线之间的连续性以达到平滑的目的,需要对曲线的控制顶点进行相应调整。因此,可根据具体的目标对需要调整的控制顶点进行优化选取,使得平滑后的链接曲线满足相应的要求。针对这一问题,给出了3种目标下优化调整控制顶点的方法。方法 首先对讨论的问题进行描述,分别指出链接Bézier曲线从C0连续平滑为C1连续和从C1连续平滑为C2连续两种情形需调整的控制顶点;然后分别给出两种情形下,以新旧控制顶点距离极小为目标、曲线内能极小为目标、新旧控制顶点距离与曲线内能同时极小为目标,对链接Bézier曲线进行平滑的方法,最后对3种极小化方法进行对比,并指出了不同方法的适用场合。结果 数值算例表明,距离极小化方法调整后的控制顶点偏离原控制顶点的距离相对较小,适合于控制顶点取自于实物时的应用场合;内能极小化方法获得的链接曲线内能相对较小,适合于要求曲线能量尽可能小的应用场合;距离与内能同时极小化方法兼顾了新旧控制顶点的距离和链接曲线的内能,适合于对两个目标都有要求的应用场合。结论 提出的方法为链接Bézier曲线的平滑提供了3种有效手段,且易于实现,对其他类型链接曲线的平滑具有参考价值。

关键词

Bézier曲线; 链接; 平滑; 控制顶点优化; 距离极小; 内能极小

Smoothing linked Bézier curves by distance and internal energy minimization
expand article info Li Juncheng, Liu Chengzhi, Liu Shanjun
College of Mathematics and Finance, Hunan University of Humanities, Science and Technology, Loudi 417000, China
Supported by: Natural Science Foundation of Hunan Province, China(2021JJ30373); Scientific Research Fund of Hunan Provincial Education Department(18A415)

Abstract

Objective The Bézier curve is a widely used tool in the representation of parametric curves. At present,most computer aided design (CAD) systems take the Bézier curve as a basic module. When using the Bézier curve for geometric modeling,it is often necessary to link multiple curves to meet the needs of designing complex curves. In order to satisfy the continuity between the linked Bézier curves,the control points that satisfy the corresponding continuity conditions need to be selected in advance. For linked Bézier curves with low order continuity,the control points of the curves can be adjusted to improve the continuity so as to smooth the linked curves. In theory,the continuity between linked Bézier curves can be improved by arbitrarily adjusting the control points of the curves to make the corresponding continuity conditions hold. However,this kind of adjustment of control points without specific objectives is often unable to meet the needs of practical applications. Given that the continuity can be improved by adjusting the control points of the linked Bézier curves,the control points that need to be adjusted can be optimized according to some specific targets,so that the smooth linked curves meet the corresponding requirements. In practical applications,if the control points of the curves are taken from the real objects,it is often hoped that the distance between the new control points and the original control points is as small as possible. Hence,the minimum distance between the new control points and the original control points can be used as the target to optimize the control points that need to be adjusted. In addition,energy minimization has become a common method for constructing curves and surfaces in CAD and related fields. Thus,the minimum energy can be used as a target to optimize the control points that need to be adjusted. In this study,three methods for smoothing the linked Bézier curves from C0 to C1 and from C1 to C2 by distance and internal energy minimization are given. Method First,the problems to be discussed are described,and the control points to be adjusted are pointed out when smoothing the linked Bézier curves from C0 to C1 and from C1 to C2. Two control points need to be adjusted when smoothing the linked Bézier curves from C0 to C1 or from C1 to C2. However,only one of them needs to be optimized due to the relationship between the two control points that need to be adjusted. Then,the distance minimizations for smoothing the linked Bézier curves from C0 to C1 and from C1 to C2 are presented. Next,the internal energy minimizations for smoothing the linked Bézier curves from C0 to C1 and from C1 to C2 are given. Then,the simultaneous minimization of the distance and the internal energy for smoothing the linked Bézier curves from C0 to C1 and from C1 to C2 are provided. The optimal solutions of the control points that need to be adjusted can be easily obtained by solving the corresponding unconstrained optimization problems. Finally,the comparison of the three minimization methods is given,and the applicable occasions of different methods are pointed out. The distance between the new control points and the original control points by the distance minimization is relatively small,which is suitable for the application when the control points are taken from the real object; the internal energy of the linked curves obtained by the internal energy minimization is relatively small,which is suitable for the application where the energy of the curve is required to be as small as possible; the distance and internal energy minimization simultaneously takes into account the distance between the new control points and the original control points and the internal energy of the linked curves,which is suitable for applications where both targets are required. Some numerical examples are presented to illustrate the effectiveness of the proposed methods. Result By using the distance minimization,the total distance between the new control points and the original control points is obviously smaller than that of the other two methods. When the control points of Bézier curves are all taken from the real object,the distance between the new control points and the original control points should not be too large,so the distance minimization method is more suitable. By using the internal energy minimization,the total internal energy of the curves is obviously smaller than that of the other two methods. When the energy of the curve is required to be as small as possible,the internal energy minimization is more suitable. In addition,given that the stretch energy,strain energy,and curvature variation energy correspond to the arc length,curvature,and curvature variation of the curve,the corresponding minimization method can be selected according to the specific requirements. By using the simultaneous minimization of distance and internal energy,the total distance between the new control points and the original control points and the total internal energy of the curves are between the other two methods. When the distance between the new control points and the original control points should not be too large and the energy of the curve should be as small as possible,the method of simultaneous minimization of distance and internal energy is a better choice. Conclusion The proposed methods provide three effective means for smoothing the linked Bézier curves and are easy to implement. The linked Bézier curves can be effectively smoothed from C0 to C1 and from C1 to C2 by using the proposed methods according to the demand of minimum distance or internal energy. When smoothing other types of link curves,the distance minimization,internal energy minimization,and simultaneous minimization of distance and internal energy proposed in this study maybe useful.

Key words

Bézier curve; link; smoothing; control points optimization; distance minimization; internal energy minimization

0 引言

在参数曲线的表示中,Bézier曲线(Farin,2002)是应用广泛的一种工具。目前,大多数CAD(computer aided design)系统都将Bézier曲线作为一个基础模块。在使用Bézier曲线进行几何造型时,为满足复杂曲线的设计需要,往往要对多条Bézier曲线进行链接。若使链接Bézier曲线之间满足一定的连续性,需要事先选定满足相应连续性条件的控制顶点。然而,即使对于满足低阶连续的链接Bézier曲线,也存在如何通过调整控制顶点提高曲线间连续性平滑链接曲线的问题。在理论上,只需使曲线连续性条件成立即可通过调整控制顶点提高链接Bézier曲线之间的连续性,但这种没有具体目标的调整往往无法适应实际应用的需求。

通过调整控制顶点可以提高链接Bézier曲线之间的连续性,那么可根据具体目标对相应的控制顶点进行优化,使平滑后的链接曲线满足相应的需求。在实际应用中,通过调整控制顶点对链接Bézier曲线进行平滑时,若曲线的控制顶点均取自实物,则希望平滑后曲线的新控制顶点与原控制顶点的距离尽可能小,故将新控制顶点与原控制顶点的距离极小作为目标来平滑链接Bézier曲线。另外,利用能量极小化方法构造曲线曲面已成为CAD及其相关领域的常用手段。例如,能量极小的Bézier曲线(Xu等,2011Ahn等,2014Erișkin和Yücesan,2016韩志红和朱春钢,2020)、B样条曲线(Vassilev,1996Xu等,2019)、Hermite插值(Yong和Cheng,2004Jaklič和Žagar, 2011a, bLu, 2015a, bLu等,2018Li和Zhang,2020)以及利用能量极小化方法构造插值曲线曲面(Goodman等,1998Zhang等,2001Li等,2020)和曲面网格(Bock和Stiller, 2014, 2018)等。因此,也可将能量极小作为目标来平滑链接Bézier曲线。

本文分别给出了基于控制顶点距离极小、曲线内能极小和控制顶点距离与曲线内能同时极小的链接Bézier曲线平滑方法,为链接曲线的平滑提供了3种有效手段。

1 问题的描述

给定两条Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$,表达式分别为

$ \begin{aligned} \boldsymbol{C}_{1}(t) &=\sum\limits_{i=0}^{m} B_{i, m}(t) \boldsymbol{p}_{i} \\ \boldsymbol{C}_{2}(t) &=\sum\limits_{j=0}^{n} B_{j, n}(t) \boldsymbol{q}_{j} \end{aligned} $ (1)

式中,$0 \leqslant t \leqslant 1, B_{i, m}(t)=\frac{m!}{i!(m-i)!}(1-t)^{m-i} t^{i}$$B_{j, n}(t)=\frac{n!}{j!(n-j)!}(1-t)^{n-j} t^{j}, \boldsymbol{p}_{i}(i=0, 1, \cdots, m)$${\mathit{\boldsymbol{q}}}_{j}$ $(j=0, 1, …, n)$分别为两曲线的控制顶点。

讨论的问题是:若${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$在链接时满足低阶连续性,在链接点固定时,如何通过调整两曲线的控制顶点提高它们之间的连续性,从而达到平滑两链接曲线的目的。

由于$C^{1}$$C^{2}$连续可满足大多数实际工程问题的需要,故仅考虑$C^{0}$链接平滑为$C^{1}$链接和$C^{1}$链接平滑为$C^{2}$链接两种情形。

1)$C^{0}$链接平滑为$C^{1}$链接。由式(1)可得

$ \begin{cases}\boldsymbol{C}_{1}(1)=\boldsymbol{p}_{m}, & \boldsymbol{C}_{1}^{\prime}(1)=m\left(\boldsymbol{p}_{m}-\boldsymbol{p}_{m-1}\right) \\ \boldsymbol{C}_{2}(0)=\boldsymbol{q}_{0}, & \boldsymbol{C}_{2}^{\prime}(0)=n\left(\boldsymbol{q}_{1}-\boldsymbol{q}_{0}\right)\end{cases} $ (2)

要使${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$满足${\mathit{\boldsymbol{C}}}^{1}$链接,则必有${\mathit{\boldsymbol{C}}}_{1}(1)={\mathit{\boldsymbol{C}}}_{2}(0)$${\mathit{\boldsymbol{C}}}′ _{1}(1)={\mathit{\boldsymbol{C}}}′ _{2}(0)$,即由式(2)可得

$ \left\{\begin{array}{l} \boldsymbol{p}_{m}=\boldsymbol{q}_{0} \\ m\left(\boldsymbol{p}_{m}-\boldsymbol{p}_{m-1}\right)=n\left(\boldsymbol{q}_{1}-\boldsymbol{q}_{0}\right) \end{array}\right. $ (3)

${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$的链接点${\mathit{\boldsymbol{d}}}={\mathit{\boldsymbol{p}}}_{m}={\mathit{\boldsymbol{q}}}_{0}$。由式(3)不难发现,当${\mathit{\boldsymbol{d}}}$固定时,要使两链接曲线从$C^{0}$平滑为$C^{1}$,只需调整曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$的控制顶点${\mathit{\boldsymbol{p}}}_{m-1}$和曲线${\mathit{\boldsymbol{C}}}_{\rm 2}(t)$的控制顶点${\mathit{\boldsymbol{q}}}_{1}$即可。如图 1所示,三次Bézier曲线与四次Bézier曲线满足$C^{0}$链接,调整控制顶点${\mathit{\boldsymbol{p}}}_{\rm 2}$${\mathit{\boldsymbol{q}}}_{\rm 1}$后将曲线平滑为$C^{1}$链接。

图 1 $C^{\rm 0}$链接(虚线)平滑为$C^{\rm 1}$链接(实线)
Fig. 1 Smoothing the linked curves from $ C^{\rm 0}$(dotted lines) to $C^{\rm 1}$(solid lines)
((a)control polygon; (b)linked curves)

2)$C^{1}$链接平滑为$C^{2}$链接。由式(1)可得

$ \left\{\begin{array}{l} \boldsymbol{C}_{1}^{\prime \prime}(1)=m(m-1)\left(\boldsymbol{p}_{m-2}-2 \boldsymbol{p}_{m-1}+\boldsymbol{p}_{m}\right) \\ \boldsymbol{C}_{2}^{\prime \prime}(0)=n(n-1)\left(\boldsymbol{q}_{0}-2 \boldsymbol{q}_{1}+\boldsymbol{q}_{2}\right) \end{array}\right. $ (4)

要使${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$满足${\mathit{\boldsymbol{C}}}^{2}$链接,除满足式(3),还需满足${\mathit{\boldsymbol{C}}}″ _{1}(1) = {\mathit{\boldsymbol{C}}}″ _{2}(0)$,即由式(4)可得

$ \begin{array}{c} m(m-1)\left(\boldsymbol{p}_{m-2}-2 \boldsymbol{p}_{m-1}+\boldsymbol{p}_{m}\right)= \\ n(n-1)\left(\boldsymbol{q}_{0}-2 \boldsymbol{q}_{1}+\boldsymbol{q}_{2}\right) \end{array} $ (5)

从式(5)可以看出,当${\mathit{\boldsymbol{d}}}$固定且式(3)成立时,要使两链接曲线从$C^{1}$平滑为$C^{2}$,只需调整曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$的控制顶点${\mathit{\boldsymbol{p}}}_{m-2}$和曲线${\mathit{\boldsymbol{C}}}_{\rm 2}(t)$的控制顶点${\mathit{\boldsymbol{q}}}_{2}$即可。如图 2所示,三次Bézier曲线与四次Bézier曲线满足$C^{1}$链接,调整控制顶点${\mathit{\boldsymbol{p}}}_{\rm 1}$${\mathit{\boldsymbol{q}}}_{\rm 2}$后将曲线平滑为$C^{2}$链接。

图 2 $C^{\rm 1}$链接(虚线)平滑为$C^{\rm 2}$链接(实线)
Fig. 2 Smoothing the linked curves from$ C^{\rm 1}$(dotted lines) to $C^{\rm 2}$ (solid lines)
((a)control polygon; (b)linked curves)

对于上述两种情形,当${\mathit{\boldsymbol{d}}}$固定时,理论上可任意调整相应控制顶点的位置,只需使连续性条件成立即可对链接Bézier曲线进行平滑。当然,也可根据特定目标对控制顶点的位置进行优化调整,以使链接Bézier曲线平滑后满足相应的需求。

2 链接Bézier曲线平滑方法

2.1 基于距离极小的链接曲线平滑

若Bézier曲线的控制顶点取自于实物,通过调整控制顶点对链接Bézier曲线进行平滑时,往往希望平滑后曲线的新控制顶点与原控制顶点的距离尽可能小,此时可将新控制顶点与原控制顶点的总距离极小作为目标来优化相应控制顶点的位置。

2.1.1 $C ^{\rm 0}$平滑为$C ^{\rm 1}$

为使两链接曲线从$C ^{0}$平滑为$C ^{1}$,假设将控制顶点${\mathit{\boldsymbol{p}}}_{m-1}$调整为${\mathit{\boldsymbol{p}}}^{[1]}_{m-1}$${\mathit{\boldsymbol{q}}}_{\rm 1}$调整为${\mathit{\boldsymbol{q}}}^{[1]}_{\rm 1}$,则新控制顶点与原控制顶点的总距离可表示为

$ D_{1}=\sqrt{\left\|\boldsymbol{p}_{m-1}^{[1]}-\boldsymbol{p}_{m-1}\right\|^{2}}+\sqrt{\left\|\boldsymbol{q}_{1}^{[1]}-\boldsymbol{q}_{1}\right\|^{2}} $ (6)

为方便计算,式(6)可近似表示(Juhász和Róth,2019)为

$ \hat{D}_{1}=\left\|\boldsymbol{p}_{m-1}^{[1]}-\boldsymbol{p}_{m-1}\right\|^{2}+\left\|\boldsymbol{q}_{1}^{[1]}-\boldsymbol{q}_{1}\right\|^{2} $ (7)

由于平滑后两链接曲线之间满足$C ^{1}$连续,故依据式(3)有

$ \boldsymbol{q}_{1}^{[1]}=-\frac{m}{n} \boldsymbol{p}_{m-1}^{[1]}+\boldsymbol{e}_{1} $ (8)

式中, $\boldsymbol{e}_{1}=\left(1+\frac{m}{n}\right) \boldsymbol{d}$

将式(8)代入式(7)有

$ \hat{D}_{1}=\left\|\boldsymbol{p}_{m-1}^{[1]}-\boldsymbol{p}_{m-1}\right\|^{2}+\left\|-\frac{m}{n} \boldsymbol{p}_{m-1}^{[1]}+\boldsymbol{e}_{1}-\boldsymbol{q}_{1}\right\|^{2} $ (9)

显然,式(9)中仅有${\mathit{\boldsymbol{p}}}^{[1]}_{m-1}$为自由量。因此,要使调整后的控制顶点与原控制顶点的总距离极小,可得无约束优化问题

$ \min \hat{D}_{1}\left(\boldsymbol{p}_{m-1}^{[1]}\right) $ (10)

定理1   将链接Bézier曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{0}$平滑为$C^{1}$时,要使调整后的控制顶点与原控制顶点的总距离极小,只需将调整后的控制顶点${\mathit{\boldsymbol{p}}}^{[1]}_{m-1}$${\mathit{\boldsymbol{q}}}^{[1]}_{\rm 1}$取为

$ \left\{\begin{array}{l} \boldsymbol{p}_{m-1}^{[1]}=\frac{n\left(n \boldsymbol{p}_{m-1}+m\left(\boldsymbol{e}_{1}-\boldsymbol{q}_{1}\right)\right)}{m^{2}+n^{2}} \\ \boldsymbol{q}_{1}^{[1]}=-\frac{m}{n} \boldsymbol{p}_{m-1}^{[1]}+\boldsymbol{e}_{1} \end{array}\right. $ (11)

式中, ${\mathit{\boldsymbol{e}}_1} = \left({1 + \frac{m}{n}} \right)\mathit{\boldsymbol{d}}$

证明:由式(9)可得

$ \frac{\partial \hat{D}_{1}}{\partial \boldsymbol{p}_{m-1}^{[1]}}=2\left(\boldsymbol{p}_{m-1}^{[1]}-\boldsymbol{p}_{m-1}\right)-\frac{2 m}{n}\left(-\frac{m}{n} \boldsymbol{p}_{m-1}^{[1]}+\boldsymbol{e}_{1}-\boldsymbol{q}_{1}\right) $ (12)

由于无约束优化问题(10)的最优解可由$\partial \hat{D}_{1} / \partial \boldsymbol{p}_{m-1}^{[1]}=\bf{0}$获得,故由式(12)求解方程及式(8)即可得式(11)。

例1    给定控制顶点${\mathit{\boldsymbol{p}}}_{0}=(-4, 0)$${\mathit{\boldsymbol{p}}}_{1}=(-3, 2)$${\mathit{\boldsymbol{p}}}_{2}=(-1, 2)$${\mathit{\boldsymbol{p}}}_{3}=(0, 0)$${\mathit{\boldsymbol{q}}}_{0}=(0, 0)$${\mathit{\boldsymbol{q}}}_{1}=(1, 2)$${\mathit{\boldsymbol{q}}}_{2}=(3, 2)$${\mathit{\boldsymbol{q}}}_{3}=(4, 1)$${\mathit{\boldsymbol{q}}}_{4}=(3, 0)$。由控制顶点${\mathit{\boldsymbol{p}}}_{i}(i=0, 1, 2, 3)$确定的三次Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$与由控制顶点${\mathit{\boldsymbol{q}}}_{i}(i=0, 1, 2, 3, 4)$确定的四次Bézier曲线${\mathit{\boldsymbol{C}}}_{2}(t)$仅满足$C^{0}$链接,现将链接的${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{0}$平滑为$C^{1}$。若使调整后的控制顶点与原控制顶点的总距离极小,由式(11)可得调整后的控制顶点为${\mathit{\boldsymbol{p}}}^{[1]}_{2}=(-1.120 0, 0.320 0)$${\mathit{\boldsymbol{q}}}^{[1]}_{1}=(0.840 0, -0.240 0)$。原$C^{0}$链接曲线与平滑后的$C^{1}$链接曲线如图 3所示。

图 3 距离极小的$C^{\rm 0}$链接(虚线)平滑为$C^{\rm 1}$链接(实线)
Fig. 3 Smoothing the linked curves from$ C^{\rm 0}$(dotted lines)to $C^{\rm 1}$(solid lines)by distance minimization
((a)control polygon; (b)linked curves)

2.1.2 $C ^{\rm 1}$平滑为$C ^{\rm 2}$

为使两链接曲线从$C^{1}$平滑为$C^{2}$,假设将控制顶点${\mathit{\boldsymbol{p}}}_{m-2}$调整为${\mathit{\boldsymbol{p}}}^{[1]}_{m-2}$${\mathit{\boldsymbol{q}}}_{\rm 2}$调整为${\mathit{\boldsymbol{q}}}^{[1]}_{\rm 2}$,则新控制顶点与原控制顶点的总距离可近似表示为

$ \hat{D}_{2}=\left\|\boldsymbol{p}_{m-2}^{[1]}-\boldsymbol{p}_{m-2}\right\|^{2}+\left\|\boldsymbol{q}_{2}^{[1]}-\boldsymbol{q}_{2}\right\|^{2} $ (13)

由于平滑后两链接曲线之间满足$C^{2}$连续,故依据式(3)与式(5),有

$ \boldsymbol{q}_{2}^{[1]}=\frac{m(m-1)}{n(n-1)} \boldsymbol{p}_{m-2}^{[1]}+\boldsymbol{e}_{2} $ (14)

式中, $\boldsymbol{e}_{2}=-\left(\frac{2 m(m-1)}{n(n-1)}+\frac{2 m}{n}\right) \boldsymbol{p}_{m-1}+$ $\left(\frac{m(m-1)}{n(n-1)}+\frac{2 m}{n}+1\right) \boldsymbol{d}$

将式(14)代入式(13)有

$ \begin{gathered} \hat{D}_{2}=\left\|\boldsymbol{p}_{m-2}^{[1]}-\boldsymbol{p}_{m-2}\right\|^{2}+ \\ \left\|\frac{m(m-1)}{n(n-1)} \boldsymbol{p}_{m-2}^{[1]}+\boldsymbol{e}_{2}-\boldsymbol{q}_{2}\right\|^{2} \end{gathered} $ (15)

显然,在式(15)中仅有${\mathit{\boldsymbol{p}}}^{[1]}_{m-2}$为自由量。因此,要使调整后的控制顶点与原控制顶点的总距离极小,可得无约束优化问题

$ \min \hat{D}_{2}\left(\boldsymbol{p}_{m-2}^{[1]}\right) $ (16)

定理2   将链接Bézier曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{1}$平滑为$C^{2}$时,要使调整后的控制顶点与原控制顶点的总距离极小,只需将调整后的控制顶点${\mathit{\boldsymbol{p}}}^{[1]}_{m-2}$${\mathit{\boldsymbol{q}}}^{[1]}_{\rm 2}$取为

$ \left\{\begin{array}{l} \boldsymbol{p}_{m-2}^{[1]}= \\ \frac{n(n-1)\left(n(n-1) \boldsymbol{p}_{m-2}-m(m-1)\left(\boldsymbol{e}_{2}-\boldsymbol{q}_{2}\right)\right)}{m^{2}(m-1)^{2}+n^{2}(n-1)^{2}} \\ \boldsymbol{q}_{2}^{[1]}=\frac{m(m-1)}{n(n-1)} \boldsymbol{p}_{m-2}^{[1]}+\boldsymbol{e}_{2} \end{array}\right. $ (17)

式中, $\boldsymbol{e}_{2} \quad=-\left(\frac{2 m(m-1)}{n(n-1)}+\frac{2 m}{n}\right) \boldsymbol{p}_{m-1}+$$\left(\frac{m(m-1)}{n(n-1)}+\frac{2 m}{n}+1\right) \boldsymbol{d}$

定理2的证明与定理1的证明过程类似。

例2   给定控制顶点${\mathit{\boldsymbol{p}}}_{0}=(-4, 0)$${\mathit{\boldsymbol{p}}}_{1}=(-3, 2)$${\mathit{\boldsymbol{p}}}_{2}=(-2, 2)$${\mathit{\boldsymbol{p}}}_{3}=(0, 0)$${\mathit{\boldsymbol{q}}}_{0}=(0, 0)$${\mathit{\boldsymbol{q}}}_{1}=(1.5, -1.5)$${\mathit{\boldsymbol{q}}}_{2}=(3, 2)$${\mathit{\boldsymbol{q}}}_{3}=(4, 1)$${\mathit{\boldsymbol{q}}}_{4}=(3, 0)$。由控制顶点${\mathit{\boldsymbol{p}}}_{i}(i=0, 1, 2, 3)$确定的三次Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$与由控制顶点${\mathit{\boldsymbol{q}}}_{i}(i=0, 1, 2, 3, 4)$确定的四次Bézier曲线${\mathit{\boldsymbol{C}}}_{2}(t)$满足$C^{1}$链接,现将链接的${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{1}$平滑为$C^{2}$。若使调整后的控制顶点与原控制顶点的总距离极小,由式(17)可得调整后的控制顶点为${\mathit{\boldsymbol{p}}}^{[1]}_{1}=(-3.200 0, 4.400 0)$${\mathit{\boldsymbol{q}}}^{[1]}_{2}=(3.400 0, -2.800 0)$。原$C^{1}$链接曲线与平滑后的$C^{2}$链接曲线如图 4所示。

图 4 距离极小的$C^{\rm 1}$链接(虚线)平滑为$C^{\rm 2}$链接(实线)
Fig. 4 Smoothing the linked curves from$ C^{\rm 1}$ dotted lines)to $C^{\rm 2}$(solid lines)by distance minimization
((a)control polygon; (b)linked curves)

2.2 基于内能极小的链接曲线平滑

通过曲线内能极小化构造曲线是一种常见的手段。拉伸能、应变能与曲率变化能是曲线内能的3种常见形式,分别对应曲线的弧长、曲率和曲率变化率(Xu等,2011)。通过调整控制顶点对链接Bézier曲线进行平滑时,若希望平滑后两条曲线的内能尽可能小,此时则可将曲线的总内能极小作为目标来优化相应控制顶点的位置。

给定参数曲线${\mathit{\boldsymbol{r}}}(t)$,其拉伸能、应变能与曲率变化能可分别定义(Xu等,2011)为

$ \left\{\begin{array}{l} E_{1}=\int_{0}^{1}\left\|\boldsymbol{r}^{\prime}(t)\right\| \mathrm{d} t \\ E_{2}=\int_{0}^{1} \kappa^{2}(t)\left\|\boldsymbol{r}^{\prime}(t)\right\| \mathrm{d} t \\ E_{3}=\int_{0}^{1}\left[{\kappa}^{\prime}(t)\right]^{2} \mathrm{~d} t \end{array}\right. $ (18)

式中,$κ(t)$为曲线${\mathit{\boldsymbol{r}}}(t)$的曲率。

为简化计算,式(19)可近似表示(Veltkamp和Wesselink,1995)为

$ \left\{\begin{array}{l} \hat{E}_{1}=\int_{0}^{1}\left\|\boldsymbol{r}^{\prime}(t)\right\|^{2} \mathrm{~d} t \\ \hat{E}_{2}=\int_{0}^{1}\left\|\boldsymbol{r}^{\prime \prime}(t)\right\|^{2} \mathrm{~d} t \\ \hat{E}_{3}=\int_{0}^{1}\left\|\boldsymbol{r}^{\prime}(t)\right\|^{2} \mathrm{~d} t \end{array}\right. $ (20)

2.2.1 $C^{\rm 0}$平滑为$C^{\rm 1}$

为使两链接曲线从$C^{0}$平滑为$C^{1}$,假设将控制顶点${\mathit{\boldsymbol{p}}}_{m-1}$调整为${\mathit{\boldsymbol{p}}}^{[2]}_{m-1}$${\mathit{\boldsymbol{q}}}_{\rm 1}$调整为${\mathit{\boldsymbol{q}}}^{[2]}_{\rm 1}$。依据式(20),可将平滑后两曲线的总内能近似表示为

$ \begin{gathered} \hat{E}_{1 r}=\int_{0}^{1}\left\|\boldsymbol{C}_{1}^{(r)}(t)\right\|^{2} \mathrm{~d} t+\int_{0}^{1}\left\|\boldsymbol{C}_{2}^{(r)}(t)\right\|^{2} \mathrm{~d} t= \\ \int_{0}^{1}\left\|\boldsymbol{f}_{1}^{(r)}(t)+B_{m-1, m}^{(r)}(t) \boldsymbol{p}_{m-1}^{[2]}\right\|^{2} \mathrm{~d} t+ \\ \int_{0}^{1}\left\|\boldsymbol{f}_{2}^{(r)}(t)+B_{1, n}^{(r)}(t) \boldsymbol{q}_{1}^{[2]}\right\|^{2} \mathrm{~d} t \end{gathered} $ (21)

式中,$\boldsymbol{f}_{1}(t)=\sum\limits_{i=0}^{m-2} B_{i, m}(t) \boldsymbol{p}_{i}+B_{m, m}(t) \boldsymbol{p}_{m}, \boldsymbol{f}_{2}(t)=$$B_{0, n}(t) \boldsymbol{q}_{0}+\sum\limits_{j=2}^{n} B_{j, n}(t) \boldsymbol{q}_{i}$

由于平滑后两链接曲线之间满足$C^{1}$连续,故依据式(8),有

$ \boldsymbol{q}_{1}^{[2]}=-\frac{m}{n} \boldsymbol{p}_{m-1}^{[2]}+\boldsymbol{e}_{1} $ (22)

由式(22)可知,式(21)中仅有${\mathit{\boldsymbol{p}}}^{[2]}_{m-1}$为自由量。因此,要使平滑后两条曲线的总内能极小,可得无约束优化问题

$ \min \hat{E}_{1 r}\left(\boldsymbol{p}_{m-1}^{[2]}\right) $ (23)

定理3   将链接Bézier曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{0}$平滑为$C^{1}$时,要使平滑后两条曲线的总内能极小,只需将调整后的控制顶点${\mathit{\boldsymbol{p}}}^{[2]}_{m-1}$${\mathit{\boldsymbol{q}}}^{[2]}_{\rm 1}$取为

$ \left\{\begin{array}{l} \boldsymbol{p}_{m-1}^{[2]}=\frac{n\left(m b_{1 r} \boldsymbol{e}_{1}-n \boldsymbol{v}_{1 r}+m \boldsymbol{w}_{1 r}\right)}{m^{2} b_{1 r}+n^{2} a_{1 r}} \\ \boldsymbol{q}_{1}^{[2]}=-\frac{m}{n} \boldsymbol{p}_{m-1}^{[2]}+\boldsymbol{e}_{1} \end{array}\right. $ (24)

式中,常数$a_{ 1r}$$b_{ 1r}$分别为${a_{1r}} = \int_0^1 {{{\left({B_{m - 1, m}^{(r)}(t)} \right)}^2}} {\rm{d}}t, \; {b_{1r}} = \int_0^1 {{{\left({B_{1, n}^{(r)}(t)} \right)}^2}} {\rm{d}}t$。常向量$\boldsymbol{v}_{1 r}=\int_{0}^{1} B_{m-1, m}^{(r)}(t) \boldsymbol{f}_{1}^{(r)}(t) \mathrm{d} t, \boldsymbol{w}_{1 r}=\int_{0}^{1} B_{1, n}^{(r)}(t) \boldsymbol{f}_{2}^{(r)}(t) \mathrm{d} t$$\boldsymbol{e}_{1}=\left(1+\frac{m}{n}\right) \boldsymbol{d}$。其中,$\boldsymbol{f}_{1}(t)=\sum\limits_{i=0}^{m-2} B_{i, m}(t) \boldsymbol{p}_{i}+$$B_{m, m}(t) \boldsymbol{p}_{m}, \boldsymbol{f}_{2}(t)=B_{0, n}(t) \boldsymbol{q}_{0}+\sum\limits_{j=2}^{n} B_{j, n}(t) \boldsymbol{q}_{i}$

证明:将式(22)代入式(21),可得

$ \begin{aligned} &\hat{E}_{1 r}=a_{1 r}\left\|\boldsymbol{p}_{m-1}^{[2]}\right\|^{2}+b_{1 r}\left\|-\frac{m}{n} \boldsymbol{p}_{m-1}^{[2]}+\boldsymbol{e}_{1}\right\|^{2}+ \\ &2 \boldsymbol{v}_{1 r} \cdot \boldsymbol{p}_{m-1}^{[2]}+2 \boldsymbol{w}_{1 r} \cdot\left(-\frac{m}{n} \boldsymbol{p}_{m-1}^{[2]}+\boldsymbol{e}_{1}\right)+c_{1 r} \end{aligned} $ (25)

式中,$c_{1 r}=\int_{0}^{1}\left\|\boldsymbol{f}_{1}^{(r)}(t)\right\|^{2} \mathrm{~d} t+\int_{0}^{1}\left\|\boldsymbol{f}_{2}^{(r)}(t)\right\|^{2} \mathrm{~d} t$

由式(25)可得

$ \begin{gathered} \frac{\partial \hat{E}_{1 r}}{\boldsymbol{p}_{m-1}^{[2]}}=2 a_{1} \boldsymbol{p}_{m-1}^{[2]}-\frac{2 m}{n} b_{1 r}\left(-\frac{m}{n} \boldsymbol{p}_{m-1}^{[2]}+\boldsymbol{e}_{1}\right)+ \\ 2 \boldsymbol{v}_{1 r}-\frac{2 m}{n} \boldsymbol{w}_{1 r} \end{gathered} $ (26)

由于无约束优化问题(23)的最优解可由$\partial \hat{E}_{1 r} / \partial \boldsymbol{p}_{m-1}^{[2]}=\bf{0}$获得,故由式(26)求解方程及式(22)即可得式(24)。

例3   对例1给定的Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$,现将链接的两曲线从$C^{0}$平滑为$C^{1}$。若使平滑后两条曲线的总内能极小,由式(24)可得调整后的控制顶点如下:

1) 拉伸能极小。即${\mathit{\boldsymbol{p}}}^{[2]}_{2}=(-1.108 7, -0.130 4)$${\mathit{\boldsymbol{q}}}^{[2]}_{1}=(0.831 5, 0.097 8)$

2) 应变能极小。${\mathit{\boldsymbol{p}}}^{[2]}_{2}=(-1.818 2, -0.090 9)$${\mathit{\boldsymbol{q}}}^{[2]}_{1}=(1.363 6, 0.068 2)$

3) 曲率变化能极小。${\mathit{\boldsymbol{p}}}^{[2]}_{2}=(-2.166 7, -0.866 7)$${\mathit{\boldsymbol{q}}}^{[2]}_{1}=(1.625 0, 0.650 0)$

$C^{0}$链接曲线与平滑后的$C^{1}$链接曲线如图 5所示。

图 5 内能极小的$C^{\rm 0}$链接(虚线)平滑为$C^{\rm 1}$链接(实线)
Fig. 5 Smoothing the linked curves from$ C^{\rm 0}$(dotted lines)to $C^{\rm 1}$(solid lines)by internal energy minimization
((a)stretch energy minimization; (b)strain energy minimization; (c)curvature variation energy mininization)

2.2.2 $C^{\rm 1}$平滑为$C^{\rm 2}$

为使两链接曲线从$C^{1}$平滑为$C^{2}$,假设将控制顶点${\mathit{\boldsymbol{p}}}_{m-2}$调整为${\mathit{\boldsymbol{p}}}^{[2]}_{m-2}$${\mathit{\boldsymbol{q}}}_{\rm 2}$调整为${\mathit{\boldsymbol{q}}}^{[2]}_{\rm 2}$。依据式(20),可将平滑后两曲线的总内能近似表示为

$ \begin{gathered} \hat{E}_{2 r}=\int_{0}^{1}\left\|\boldsymbol{g}_{1}^{(r)}(t)+B_{m-2, m}^{(r)}(t) \boldsymbol{p}_{m-2}^{[2]}\right\|^{2} \mathrm{~d} t+ \\ \int_{0}^{1}\left\|\boldsymbol{g}_{2}^{(r)}(t)+B_{2, n}^{(r)}(t) \boldsymbol{q}_{2}^{[2]}\right\|^{2} \mathrm{~d} t \end{gathered} $ (27)

式中,$\boldsymbol{g}_{1}(t)=\sum\limits_{i=0}^{m-3} B_{i, m}(t) \boldsymbol{p}_{i}+B_{m-1, m}(t) \boldsymbol{p}_{m-1}+$$B_{m, m}(t) \boldsymbol{p}_{m}, \quad \boldsymbol{g}_{2}(t)=B_{0, n}(t) \boldsymbol{q}_{0}+B_{1, n}(t) \boldsymbol{q}_{1}+$$\sum\limits_{j=3}^{n} B_{j, n}(t) \boldsymbol{q}_{i}$

由于平滑后两链接曲线之间满足$C^{2}$连续,依据式(14),有

$ \boldsymbol{q}_{2}^{[2]}=\frac{m(m-1)}{n(n-1)} \boldsymbol{p}_{m-2}^{[2]}+\boldsymbol{e}_{2} $ (28)

式中,$\boldsymbol{e}_{2}=-\left(\frac{2 m(m-1)}{n(n-1)}+\frac{2 m}{n}\right) \boldsymbol{p}_{m-1}+$$\left(\frac{m(m-1)}{n(n-1)}+\frac{2 m}{n}+1\right) \mathit{\boldsymbol{d}}$

由式(28)可知,式(27)中仅有${\mathit{\boldsymbol{p}}}^{[2]}_{m-2}$为自由量。因此,要使平滑后两条曲线的总内能极小,可得无约束优化问题

$ \min \hat{E}_{2 r}\left(\boldsymbol{p}_{m-2}^{[2]}\right) $ (29)

定理4   将链接Bézier曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{1}$平滑为$C^{2}$时,要使平滑后两条曲线的总内能极小,只需将调整后的控制顶点${\mathit{\boldsymbol{p}}}^{[2]}_{m-2}$${\mathit{\boldsymbol{q}}}^{[2]}_{\rm 2}$取为式中,常数$a_{\rm 2r}$$b_{\rm 2r}$分别为$a_{2 r}=\int_{0}^{1}\left(B_{m-2, m}^{(r)}(t)\right)^{2} \mathrm{~d} t$$\boldsymbol{b}_{2 r}=\int_{0}^{1}\left(B_{2, n}^{(r)}(t)\right)^{2} \mathrm{~d} t$。常向量${\mathit{\boldsymbol{v}}}_{2r}$, ${\mathit{\boldsymbol{w}}}_{\rm 2r}$, ${\mathit{\boldsymbol{e}}}_{\rm 2}$分别为$\int_{0}^{1} B_{2, n}^{(r)}(t) \boldsymbol{g}_{2}^{(r)}(t) \mathrm{d} t, \boldsymbol{e}_{2}=-\left(\frac{2 m(m-1)}{n(n-1)}+\frac{2 m}{n}\right) \times$$\boldsymbol{p}_{m-1}+\left(\frac{m(m-1)}{n(n-1)}+\frac{2 m}{n}+1\right) \boldsymbol{d}$,其中,$\mathit{\boldsymbol{g}}_{1}(t)=$$\sum\limits_{i=0}^{m-3} B_{i, m}(t) \boldsymbol{p}_{i}+B_{m-1, m}(t) \boldsymbol{p}_{m-1}+B_{m, m}(t) \boldsymbol{p}_{m}, \boldsymbol{g}_{2}(t)=$$B_{0, n}(t) \boldsymbol{q}_{0}+B_{1, n}(t) \boldsymbol{q}_{1}+\sum\limits_{j=3}^{n} B_{j, n}(t) \boldsymbol{q}_{i}$

$ \left\{\begin{array}{l} \boldsymbol{p}_{m-2}^{[2]}=-\frac{n(n-1)\left(m(m-1) b_{2 r} \boldsymbol{e}_{2}+n(n-1) \boldsymbol{v}_{2 r}+m(m-1) \boldsymbol{w}_{2 r}\right)}{m^{2}(m-1)^{2} b_{2 r}+n^{2}(n-1)^{2} a_{2 r}} \\ \boldsymbol{q}_{2}^{[2]}=\frac{m(m-1)}{n(n-1)} \boldsymbol{p}_{m-2}^{[2]}+\boldsymbol{e}_{2} \end{array}\right. $ (30)

定理4的证明与定理3的证明过程类似。

例4   对例2给定的Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$,将链接的两曲线从$C^{1}$平滑为$C^{2}$。若使平滑后两条曲线的总内能极小,由式(30)可得调整后的控制顶点为

1) 拉伸能极小。即${\mathit{\boldsymbol{p}}}^{[2]}_{1}=(-3.375 0, 0.875 0)$${\mathit{\boldsymbol{q}}}^{[2]}_{2}=(3.312 5, -4.562 5)。$

2) 应变能极小。即${\mathit{\boldsymbol{p}}}^{[2]}_{1}=(-3.111 1, 2.388 9)$${\mathit{\boldsymbol{q}}}^{[2]}_{2}=(3.444 4, -3.805 6)。$

3) 曲率变化能极小。即${\mathit{\boldsymbol{p}}}^{[2]}_{1}=(-3.523 8, 6.190 5)$${\mathit{\boldsymbol{q}}}^{[2]}_{2}=(3.238 1, -1.904 8)$

$C^{1}$链接曲线与平滑后的$C^{2}$链接曲线如图 6所示。

图 6 内能极小的$C^{\rm 1}$链接(虚线)平滑为$C^{\rm 2}$链接(实线)
Fig. 6 Smoothing the linked curves from$ C^{\rm 1}$(dotted lines)to $C^{\rm 2}$(solid lines)by internal energy minimization
((a)stretch energy minimization; (b)strain energy minimization; (c)curvature variation energy mininization)

2.3 基于距离与内能极小的链接曲线平滑

通过调整控制顶点对链接Bézier曲线平滑时,若同时希望平滑后曲线的新控制顶点与原控制顶点的距离以及两条曲线的内能尽可能小,此时可将新控制顶点与原控制顶点的总距离和曲线的总内能作为双目标来优化相应控制顶点的位置。

2.3.1 $C^{\rm 0}$平滑为$C^{\rm 1}$

为了使两链接曲线从$C^{0}$平滑为$C^{1}$,假设将控制顶点${\mathit{\boldsymbol{p}}}_{m-1}$调整为${\mathit{\boldsymbol{p}}}^{[3]}_{m-1}$${\mathit{\boldsymbol{q}}}_{\rm 1}$调整为${\mathit{\boldsymbol{q}}}^{[3]}_{\rm 1}$。若同时以总距离函数$\hat D_{\rm 1}$与总内能函数$\hat E_{ 1r}$为极小目标,则依据式(9)与式(21)可得双目标优化问题

$ \min \left(\hat{D}_{1}\left(\boldsymbol{p}_{m-1}^{[3]}\right), \hat{E}_{1 r}\left(\boldsymbol{p}_{m-1}^{[3]}\right)\right)^{\mathrm{T}} $ (31)

一般地,问题(31)可近似转化为单目标优化问题

$ \min G_{1}\left(\boldsymbol{p}_{m-1}^{[3]}\right)=\omega \hat{D}_{1}\left(\boldsymbol{p}_{m-1}^{[3]}\right)+(1-\omega) \hat{E}_{1 r}\left(\boldsymbol{p}_{m-1}^{[3]}\right) $ (32)

式中,$ω$ $(0≤ω≤1)$为权重。

由式(32)可知,若想获得近似最优解,需事先确定权重$ω$。本文采用双目标优化中的排序法确定权重$ω$(林锉云和董加礼,1992)。

算法1利用排序法确定权重$ω$。具体步骤如下:

1) 分别计算2个单目标关于最优解${\mathit{\boldsymbol{p}}}^{[1]}_{m-1}$${\mathit{\boldsymbol{p}}}^{[2]}_{m-1}$的偏差。

$ \delta_{1}=\left|\hat{D}_{1}\left(\boldsymbol{p}_{m-1}^{[2]}\right)-\hat{D}_{1}\left(\boldsymbol{p}_{m-1}^{[1]}\right)\right| $

$ \delta_{2}=\left|\hat{E}_{1 r}\left(\boldsymbol{p}_{m-1}^{[1]}\right)-\hat{E}_{1 r}\left(\boldsymbol{p}_{m-1}^{[2]}\right)\right| $

2) 计算权重的初始值。

$ \omega_{1}=\frac{\delta_{1}}{\delta_{1}+\delta_{2}}, \omega_{2}=\frac{\delta_{2}}{\delta_{1}+\delta_{2}} $

3) 若$ω_{ 1}≥ω_{2}$,权重取为$ω=$min${ω_{1}, ω_{2}}$;否则,权重取为$ω=$max$\{ω_{1}, ω_{2}\}$

定理5   将链接Bézier曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{0}$平滑为$C^{1}$时,要使调整后的控制顶点与原控制顶点的总距离以及两条曲线的内能同时极小,只需将调整后的控制顶点${\mathit{\boldsymbol{p}}}^{[3]}_{m-1}$${\mathit{\boldsymbol{q}}}^{[3]}_{\rm 1}$取为

$ \left\{\begin{array}{l} \boldsymbol{p}_{m-1}^{[3]}=\frac{n\left(\omega\left(n \boldsymbol{p}_{m-1}+m\left(\boldsymbol{e}_{1}-\boldsymbol{q}_{1}\right)\right)+(1-\omega)\left(m b_{1 r} \boldsymbol{e}_{1}-n \boldsymbol{v}_{1 r}+m \boldsymbol{w}_{1 \mathrm{r}}\right)\right)}{\omega\left(m^{2}+n^{2}\right)+(1-\omega)\left(m^{2} b_{1 r}+n^{2} a_{1 r}\right)} \\ \boldsymbol{q}_{1}^{[3]}=-\frac{m}{n} \boldsymbol{p}_{m-1}^{[3]}+\boldsymbol{e}_{1} \end{array}\right. $ (33)

式中,常数$a_{ 1r}$$b_{ 1r}$以及常向量${\mathit{\boldsymbol{v}}}_{ 1r}$${\mathit{\boldsymbol{w}}}_{ 1r}$${\mathit{\boldsymbol{e}}}_{\rm 1}$为定理3中所示,权重$ω$由算法1确定。

证明:确定权重$ω$后,由式(12)(26),可得

$ \begin{gathered} \frac{\partial G_{1}\left(\boldsymbol{p}_{m-1}^{[3]}\right)}{\partial \boldsymbol{p}_{m-1}^{[3]}}=2 \omega\left(\boldsymbol{p}_{m-1}^{[3]}-\boldsymbol{p}_{m-1}\right)- \\ \frac{2 \omega m}{n}\left(-\frac{m}{n} \boldsymbol{p}_{m-1}^{[3]}+\boldsymbol{e}_{1}-\boldsymbol{q}_{1}\right)+ \\ 2(1-\omega) a_{1 r} \boldsymbol{p}_{m-1}^{[3]}-\frac{2(1-\omega) m}{n} b_{1 r}\left(-\frac{m}{n} \boldsymbol{p}_{m-1}^{[3]}+\boldsymbol{e}_{1}\right)+ \\ 2(1-\omega) \boldsymbol{v}_{1 r}-\frac{2(1-\omega) m}{n} \boldsymbol{w}_{1 r} \end{gathered} $ (34)

由于无约束优化问题(32)的最优解可由$\partial \hat{G}_{1} / \partial \boldsymbol{p}_{m-1}^{[3]}=\bf{0}$获得,故由式(34)求解方程以及依据式(22)即可得式(33)。

例5   对例1给定的Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$,现将链接的两曲线从$C^{0}$平滑为$C^{1}$。若使平滑后曲线的新控制顶点与原控制顶点的总距离以及两曲线的总内能同时极小,由式(33)可得调整后的控制顶点为

1) 距离与拉伸能同时极小。即${\mathit{\boldsymbol{p}}}^{[3]}_{2}=(-1.114 3, 0.094 8)$${\mathit{\boldsymbol{q}}}^{[3]}_{1}=(0.835 8, -0.071 1)$

2) 距离与应变能同时极小。即${\mathit{\boldsymbol{p}}}^{[3]}_{2}= (-1.469 1, 0.114 5)$${\mathit{\boldsymbol{q}}}^{[3]}_{1}=(1.101 8, -0.085 9) $

3) 距离与曲率变化能同时极小。即${\mathit{\boldsymbol{p}}}^{[3]}_{2}= (-1.643 3, -0.273 3)$${\mathit{\boldsymbol{q}}}^{[3]}_{1}=(1.232 5, 0.205 0) $

$C^{0}$链接曲线与平滑后的$C^{1}$链接曲线如图 7所示。

图 7 距离与内能极小的$C^{\rm 0}$链接(虚线) 平滑为$C^{\rm 1}$链接(实线)
Fig. 7 Smoothing the linked curves from$ C^{\rm 0}$ (dotted lines)to $C^{\rm 1}$(solid lines)by distance and internal energy minimization
((a)distance and stretch energy minimization; (b)distance and strain energy minimization; (c)distance and curvature variation energy mininization)

2.3.2 $C^{\rm 1}$平滑为$C^{\rm 2}$

为了使两链接曲线从$C^{0}$平滑为$C^{1}$,假设将控制顶点${\mathit{\boldsymbol{p}}}_{m-2}$调整为${\mathit{\boldsymbol{p}}}^{[3]}_{m-2}$${\mathit{\boldsymbol{q}}}_{\rm 2}$调整为${\mathit{\boldsymbol{q}}}^{[3]}_{\rm 2}$。与$C^{\rm 0}$平滑为$C^{\rm 1}$的过程类似,给出下列定理。

定理6   将链接Bézier曲线${\mathit{\boldsymbol{C}}}_{ 1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$$C^{1}$平滑为$C^{2}$时,要使调整后的控制顶点与原控制顶点的总距离以及两条曲线的内能同时极小,只需将调整后的控制顶点${\mathit{\boldsymbol{p}}}^{[3]}_{m-2}$${\mathit{\boldsymbol{q}}}^{[3]}_{\rm 2}$取为

$ \left\{\begin{array}{l} \boldsymbol{p}_{m-2}^{[3]}=\frac{n(n-1)\left(\lambda\left(n(n-1) \boldsymbol{p}_{m-2}-m(m-1)\left(\boldsymbol{e}_{2}-\boldsymbol{q}_{2}\right)\right)-(1-\lambda)\left(m(m-1) b_{2 {r}} \boldsymbol{e}_{2}+n(n-1) \boldsymbol{v}_{2 r}+m(m-1) \boldsymbol{w}_{2 r}\right)\right)}{\lambda\left(m^{2}(m-1)^{2}+n^{2}(n-1)^{2}\right)+(1-\lambda)\left(m^{2}(m-1)^{2} b_{2 r}+n^{2}(n-1)^{2} a_{2 r}\right)} \\ \boldsymbol{q}_{2}^{[3]}=\frac{m(m-1)}{n(n-1)} \boldsymbol{p}_{m-2}^{[3]}+\boldsymbol{e}_{2} \end{array}\right. $ (35)

式中,常数$a_{\rm 2r}$$b_{\rm 2r}$以及常向量${\mathit{\boldsymbol{v}}}_{\rm 2r}$${\mathit{\boldsymbol{w}}}_{\rm 2r}$${\mathit{\boldsymbol{e}}}_{\rm 2}$与定理4中一样,权重$λ$参照算法1确定。

例6    对例2给定的Bézier曲线${\mathit{\boldsymbol{C}}}_{1}(t)$${\mathit{\boldsymbol{C}}}_{2}(t)$,现将链接的两曲线从$C^{1}$平滑为$C^{2}$。若使平滑后曲线的新控制顶点与原控制顶点的总距离以及两曲线的总内能同时极小,由式(35)可得调整后的控制顶点为

1) 距离与拉伸能同时极小。即${\mathit{\boldsymbol{p}}}^{[3]}_{1}= (-3.287 5, 2.637 5)$${\mathit{\boldsymbol{q}}}^{[3]}_{2}=(3.356 3, -3.681 2)$

2) 距离与应变能同时极小。即${\mathit{\boldsymbol{p}}}^{[3]}_{1}= (-3.155 6, 3.394 4)$${\mathit{\boldsymbol{q}}}^{[3]}_{2}=(3.422 2, -3.302 8)$

3) 距离与曲率变化能同时极小。即${\mathit{\boldsymbol{p}}}^{[3]}_{1}= (-3.361 9, 5.295 2)$${\mathit{\boldsymbol{q}}}^{[3]}_{2}=(3.319 0, -2.352 4)$

$C^{1}$链接曲线与平滑后的$C^{2}$链接曲线如图 8所示。

图 8 距离与内能极小的$C^{\rm 1}$链接(虚线) 平滑为$C^{\rm 2}$链接(实线)
Fig. 8 Smoothing the linked curves from$ C^{\rm 1}$(dotted lines)to $C^{\rm 2}$ (solid lines)by distance and internal energy minimization
((a)distance and stretch energy minimization; (b)distance and strain energy minimization; (c)distance and curvature variation energy mininization)

3 不同极小化方法的对比

图 9为例1、例3与例5中分别利用距离极小化、内能极小化、距离与内能同时极小化方法将$C^{\rm 0}$链接Bézier曲线平滑为$C^{\rm 1}$链接的结果对比。其中,短虚线为$C^{\rm 0}$链接曲线,长虚线为距离极小的$C^{\rm 1}$链接曲线,点划线为内能极小的$C^{\rm 1}$链接曲线,实线为距离与内能同时极小的$C^{\rm 1}$链接曲线。3种极小化方法的计算结果如表 1所示。

图 9 不同极小化方法的$C^{\rm 0}$链接平滑为$C^{\rm 1}$链接
Fig. 9 Smoothing the linked curves from$ C^{\rm 0}$ to $C^{\rm 1}$ by different minimization methods
((a)distance and stretch energy minimization; (b)distance and strain energy minimization; (c)distance and curvature variation energy minimization)

表 1 不同极小化方法的$C^{0}$链接平滑为$C^{1}$链接计算结果
Table 1 Calculation results of linked curves from $C^{0}$ to $C^{1}$ by different minimization methods

下载CSV
图形 距离极小 内能极小 距离与内能极小
距离 内能值 距离 内能值 距离 内能值
图 9(a) 7.880 0 43.372 0 8.197 2 42.971 7 7.959 3 43.071 8
图 9(b) 7.880 0 468.706 6 8.905 5 416.727 3 8.136 4 429.722 1
图 9(c) 7.880 0 7.466 8E+3 11.792 0 4.762 8E+3 8.858 0 5.438 8E+3

图 10为例2、例4与例6中分别利用距离极小化、内能极小化、距离与内能同时极小化方法将$C^{\rm 1}$链接Bézier曲线平滑为$C^{\rm 2}$链接的结果对比。其中,短虚线为$C^{\rm 1}$链接曲线,长虚线为距离极小的$C^{\rm 2}$链接曲线,点划线为内能极小的$C^{\rm 2}$链接曲线,实线为距离与内能同时极小的$C^{\rm 2}$链接曲线。3种极小化方法的计算结果如表 2所示。

图 10 不同极小化方法的$C^{\rm 1}$链接平滑为$C^{\rm 2}$链接
Fig. 10 Smoothing the linked curves from$ C^{\rm 1}$ to $C^{\rm 2}$ by different minimization methods
((a)distance and stretch energy minimization; (b)distance and strain energy minimization; (c)distance and curvature variation energy minimization)

表 2 不同极小化方法的$C^{\rm 1}$链接平滑为$C^{\rm 2}$链接计算结果
Table 2 Calculation results of linked curves from $C^{\rm 1}$ to $C^{\rm }$

下载CSV
图形 距离极小 内能极小 距离与内能同时极小
距离值 内能值 距离值 内能值 距离值 内能值
图 10(a) 29.000 0 80.982 9 44.570 3 63.900 0 32.892 6 68.170 7
图 10(b) 29.000 0 1.166 4E+3 34.065 6 991.333 3 30.266 4 1.035 1E+3
图 10(c) 29.000 0 1.665 6E+4 33.138 3 1.415 3E+04 30.034 6 1.477 9E+4

表 1表 2可以看出,1)采用距离极小化方法平滑链接Bézier曲线后,曲线的新控制顶点与原控制顶点的总距离明显小于另外两种方法。在实际工程应用中,当Bézier曲线的控制顶点均取自于实物时,若需要调整控制顶点的位置,往往也要求新控制顶点偏离原控制顶点的距离不宜太大,此时距离极小化方法较为适用。2)采用内能极小化方法平滑链接Bézier曲线后,曲线的总内能明显小于另外两种方法。在实际工程应用中,若要求曲线的能量尽可能小,此时内能极小化方法较为适用。另外,由于拉伸能、应变能与曲率变化能分别对应曲线的弧长、曲率和曲率变化率,故在实际应用中可根据具体需求选取相应的极小化方法。3)采用距离与内能同时极小化方法平滑链接Bézier曲线后,曲线的新控制顶点与原控制顶点的总距离以及曲线的总内能都介于另外两种方法之间。在实际工程应用中,若既要求新控制顶点偏离原控制的距离不宜太大,也希望曲线的能量尽可能小,此时距离与内能同时极小化方法是较好的选择。

4 结论

为了通过调整控制顶点实现链接Bézier曲线的平滑,本文给出了利用控制顶点距离极小、曲线内能极小以及控制顶点距离与曲线内能同时极小等3种平滑Bézier链接曲线的方法。结果表明,利用距离极小化方法平滑链接曲线后,新控制顶点偏离原控制顶点的距离相对较小,适合于控制顶点取自于实物时的应用场合;利用内能极小化方法平滑链接曲线后,链接曲线的内能相对较小,适合于要求曲线能量尽可能小的应用场合;控制顶点距离与曲线内能同时极小化方法则同时兼顾了新旧控制顶点的距离和链接曲线的内能,适合于对两个目标都有要求的应用场合。

参考文献

  • Ahn Y J, Hoffmann C, Rosen P. 2014. Geometric constraints on quadratic Bézier curves using minimal length and energy. Journal of Computational and Applied Mathematics, 255: 887-897 [DOI:10.1016/j.cam.2013.07.005]
  • Bock K, Stiller J. 2014. Energy-minimizing curve fitting for high-order surface mesh generation. Applied Mathematics, 5(21): 3318-3327 [DOI:10.4236/am.2014.521309]
  • Bock K, Stiller J. 2018. Optimizing triangular high-order surface meshes by energy-minimization. Engineering with Computers, 34(4): 659-670 [DOI:10.1007/s00366-017-0565-3]
  • Erişkin H, Yücesan A. 2016. Bézier curve with a minimal Jerk energy. Mathematical Sciences and Applications E-Notes, 4(2): 139-148 [DOI:10.36753/mathenot.421467]
  • Farin G. 2002. Curves and surfaces for CAGD: a practical guide. Amsterdam: Elsevier
  • Goodman T N T, Ong B H, Sampoli M L. 1998. Automatic interpolation by fair, shape-preserving, G2 space curves. Computer-Aided Design, 30(10): 813-822 [DOI:10.1016/S0010-4485(98)00039-6]
  • Han Z H, Zhu C G. 2020. Construction of Bézier curves by energy constraints. Journal of Computer-Aided Design and Computer Graphics, 32(2): 213-221 (韩志红, 朱春钢. 2020. 能量约束下的Bézier曲线构造. 计算机辅助设计与图形学学报, 32(2): 213-221) [DOI:10.3724/SP.J.1089.2020.17917]
  • Jaklič G, Žagar E. 2011a. Planar cubic G1 interpolatory splines with small strain energy. Journal of Computational and Applied Mathematics, 235(8): 2758-2765 [DOI:10.1016/j.cam.2010.11.025]
  • Jaklič G, Žagar E. 2011b. Curvature variation minimizing cubic Hermite interpolants. Applied Mathematics and Computation, 218(7): 3918-3924 [DOI:10.1016/j.amc.2011.09.039]
  • Juhász I, Róth Á. 2019. Adjusting the energies of curves defined by control points. Computer-Aided Design, 107: 77-88 [DOI:10.1016/j.cad.2018.09.003]
  • Li J C, Liu C Z, Zhang L. 2020. Shape-preserving planar quadratic Bézier interpolation spline with minimal stretch energy. Journal of Testing and Evaluation, 48(3): 2432-2440 [DOI:10.1520/JTE20190809]
  • Li J C, Zhang L. 2020. Length and curvature variation energy minimizing planar cubic G1 Hermite interpolation curve. Journal of Taibah University for Science, 14(1): 60-64 [DOI:10.1080/16583655.2019.1703248]
  • Lin C Y, Dong J L. 1992. The Methods and Theories of Multi-Objective Optimizations. Changchun: Jilin Education Press (林锉云, 董加礼. 1992. 多目标优化的方法与理论. 长春: 吉林教育出版社)
  • Lu L Z. 2015a. Planar quintic G2 Hermite interpolation with minimum strain energy. Journal of Computational and Applied Mathematics, 274: 109-117 [DOI:10.1016/j.cam.2014.07.015]
  • Lu L Z. 2015b. A note on curvature variation minimizing cubic Hermite interpolants. Applied Mathematics and Computation, 259: 596-599 [DOI:10.1016/j.amc.2014.11.113]
  • Lu L Z, Jiang C K, Hu Q Q. 2018. Planar cubic G1 and quintic G2 Hermite interpolations via curvature variation minimization. Computers and Graphics, 70: 92-98 [DOI:10.1016/j.cag.2017.07.007]
  • Vassilev T I. 1996. Fair interpolation and approximation of B-splines by energy minimization and points insertion. Computer-Aided Design, 28(9): 753-760 [DOI:10.1016/0010-4485(95)00087-9]
  • Veltkamp R C, Wesselink W. 1995. Modeling 3D curves of minimal energy. Computer Graphics Forum, 14(3): 97-110 [DOI:10.1111/j.1467-8659.1995.cgf143_0097.x]
  • Xu G, Wang G Z, Chen W Y. 2011. Geometric construction of energy-minimizing Bézier curves. Science China Information Sciences, 54(7): 1395-1406 [DOI:10.1007/s11432-011-4294-8]
  • Xu G, Zhu Y F, Deng L S, Wang G Z, Li B J, Hui K C. 2019. Efficient construction of B-Spline curves with minimal internal energy. Computers, Materials and Continua, 58(3): 879-892 [DOI:10.32604/cmc.2019.03752]
  • Yong J H, Cheng F. 2004. Geometric Hermite curves with minimum strain energy. Computer Aided Geometric Design, 21(3): 281-301 [DOI:10.1016/j.cagd.2003.08.003]
  • Zhang C M, Zhang P F, Cheng F. 2001. Fairing spline curves and surfaces by minimizing energy. Computer-Aided Design, 33(13): 913-923 [DOI:10.1016/S0010-4485(00)00114-7]