若是B样条拟合曲线的节点向量与控制顶点均为变量,则该问题变为一个带约束的多维多变量高度非线性的优化问题,反求方程系统的方法已经难以求得最优解.针对该类问题,提出一种带有法向约束的粒子群优化算法(PSO)求解曲线逼近问题的方法,首先将带有法向约束的非线性最优化问题以罚函数的方法转化为无约束的最优化问题,建立一个与数据点和法向同时相关且比较合适的适应度函数(误差函数),然后以PSO调节节点向量,并使用最小二乘法求解在该节点向量下的最优拟合曲线,通过判断适应度函数值的优劣循环迭代,直到达到终止条件或者产生令人满意(误差容忍值)的拟合曲线为止.将文中算法产生的拟合曲线通过实验数据的对比与说明,突出了该方法的优越性,表明其用于解决带法向约束的逼近问题切实可行.
If the knot vector and control points of a B-spline curve are variable, the B-spline curve approximation with normal constraint problem becomes a multidimensional, multivariate and highly nonlinear optimization problem with normal constraints, the conventional method of inverse equation system is difficult to obtain the optimal solution. Aiming at this kind of problem, a particle swarm optimization(PSO) method is introduced to solve the curve approximation problem with normal constraints. Firstly, the penalty function method is used to transform the constrained optimization problem into an unconstrained optimization problem. Secondly, a suitable fitness function which is closely related to both data points and normal constraints is constructed. Finally, PSO is applied to adjust the knot vector, and at the same time, the least square method is used to solve the optimal control points, do loop iteration until the best B-spline curve approximation is produced. By a comparison with existing methods, the superiority of the proposed method is highlighted. Test results show that this method is practical in solving the curve approximation problem with normal constraints.