JCCJournal of Computer and Communications2327-5219Scientific Research Publishing10.4236/jcc.2020.86001JCC-100751ArticlesComputer Science&Communications Calculation of Space NURBS Curve Interpolation Error LiangjiChen1*FeiGao1*BoZhao1*LongfeiMa1*School of Mechanical Engineering, Tiangong University, Tianjin, China0506202008061913, May 20205, June 2020 8, June 2020© Copyright 2014 by authors and Scientific Research Publishing Inc. 2014This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/

Aiming at the problem of low accuracy of interpolation error calculation of existing NURBS curves, an approximate method for the distance between a point and a NURBS interpolation curve is proposed while satisfying the accuracy of the solution. Firstly, the minimum parameter interval of the node vector corresponding to the data point under test in the original data point sequence is determined, and the parameter interval is subdivided according to the corresponding step size, and the corresponding parameter value is obtained. Secondly, the distance from the measured point to the NURBS curve is calculated, and the nearest distance is found out. The node interval is subdivided again on one side of the nearest distance. Finally, the distance between the data point to be measured and each subdivision point is calculated again, and the minimum distance is taken as the interpolation error between the point and the NURBS curve. The simulation results of actual tool position data show that this method can more accurately obtain the error of spatial NURBS interpolation curve.

Computer-Aided Design NURBS Interpolation Curve Interpolation Error Approximation Solution
1. Introduction

NURBS curve and surface interpolation technology has a broad application prospect in Computer-Aided Design, and has become the most popular mathematical expression as early as the 1980s   . In the design and production process in the field of numerical control machining, it is necessary to seek the optimal NURBS curve and surface expression from a large number of original cutter point data . Gofuku et al.  proposed a technique to interpolate B-spline curves through geometric algorithm, which has a compact representation and does not need to be given the size of the tangent vector and the normal vector. Yoshimoto et al.  proposed a genetic algorithm based on real number coding, which can achieve a better fitting effect when dealing with smooth data. Park et al.  proposed a B-spline curve approximation method based on error adaptive control, which can obtain the minimum control point curve satisfying the preset fitting accuracy without the given number of control points.

The interpolation error is an important basis for measuring the distance between the spatial uninvolved interpolation data points and the NURBS interpolation curves. The above scholars have given corresponding interpolation error calculation models for the interpolation error calculation problem, and the quality of the error calculation model directly affects the number of iterations of the NURBS interpolation curve and the number of interpolation data points, and finally affects the efficiency in the actual processing process. In addition to the above scholars, Hu et al.  proposed a method to calculate the minimum distance between a point and a curve by using the projection method. This method has a fast convergence rate, but strict requirements on the selection of initial values in the iterative process. Stakhov  proposed a golden section method to calculate the minimum distance from the point to the curve. The method has a slow convergence speed and uncertain direction. Shopova et al.  and Vallex et al.  proposed genetic algorithm and particle swarm optimization algorithm respectively. These methods can obtain the global optimal solution, but the algorithm is complex and the calculation takes a long time. Theoretically, the interpolation error value is the radius of the circular arc tangent to the NURBS curve at the data point to be measured. The radius value is taken as the theoretical interpolation error value. Due to the complexity of the calculation of this method, most scholars have not adopted this method for calculation. Currently, the most extensive deviation calculation method is to carry out parametric calculation on all data points to be tested, calculate the corresponding points of each parameter value on the NURBS curve, and take the distance between the data points and the corresponding points on the NURBS curve as the actual interpolation error value . In view of the above calculation method, it is easy to produce the problem of low accuracy and poor reliability, which will greatly increase the number of iterations and the selection of interpolation data points.

Based on the above analysis, this article will elaborate on the following four parts. In the first part, the method steps of interpolating the global curve of a given data point are introduced in detail. In the second part, this paper proposes a new method for calculating spatial NURBS curve interpolation error, and explains the calculation process of this method in detail. In the third part, the error calculation method is compared with the existing method to show the superiority of accuracy in error calculation. The fourth part summarizes the whole paper and explains the application value of the NURBS curve error calculation method.

2. NURBS Curve Interpolation2.1. A Basic Definition of a NURBS Curve

A p-degree NURBS curve is defined as 

C ( u ) = ∑ i = 0 n N i , p ( u ) ω i P i ∑ i = 0 n N i , p ( u ) ω i , u ∈ [ 0 , 1 ] (1)

In Equation (1), { P i } is the control point of NURBS curve. The number of control points is n + 1, and the lines of all control points { P i } constitute the control polygon of NURBS curve. { ω i } is the weight factor value of the corresponding control point { P i } ; N i , p ( u ) is the pth B-spline basis function.

The B-spline basis function is defined in the node vector

U = ( u 0 , u 1 , ⋯ , u m )

(where: m = n + p + 1 , and the number of nodes is m + 1). B-spline basis function can be obtained by de Boor-Cox recurrence formula

{ N i , 0 ( u ) = { 1 , if u i ≤ u ≤ u i + 1 0 , else N i , p ( u ) = u − u i u i + p − u i N i , p − 1 ( u ) + u i + p + 1 − u u i + p + 1 − u i + 1 N i + 1 , p − 1 ( u ) let 0 0 = 0 . (2)

2.2. Calculation of NURBS Curve

For the data point set of NURBS curve interpolation, the following interpolation calculation method can be used to calculate the NURBS curve interpolation.

2.2.1. Parametric Calculation of Feature Points

First, we need to parameterize the set of data points participating in the interpolation. In this paper, the most commonly used string length parameterization method is used to parameterize the feature data points.

For data point set { Q j } ( j = 0 , 1 , 2 , ⋯ , n ) , let the total chord length be D, then there will be

D = ∑ j = 1 n | Q j − Q j − 1 | (3)

Then, the parameters corresponding to each data point { Q j } ( j = 0 , 1 , 2 , ⋯ , n ) can be represented as

u ¯ 0 = 0 u ¯ j = u ¯ j − 1 + | Q j − Q j − 1 | D , j = 1 , 2 , ⋯ , n − 1 u ¯ n = 1 . (4)

2.2.2. Node Vector Calculation

Let the node vector be U = ( u 0 , u 1 , ⋯ , u m ) . In order to make the node vector reflect the distribution of u ¯ j well, this paper adopts the method of taking the average value, namely

u 0 = ⋯ = u p = 0 u i + p = 1 p ∑ j = i i + p − 1 u ¯ j ( i = 1 , 2 , ⋯ , n − p ) u m − p = ⋯ = u m = 1 (5)

where U is equal to ( 0 , ⋯ , 0 ︸ p + 1 , u p + 1 , ⋯ , u m − p − 1 , 1 , ⋯ , 1 ︸ p + 1 ) .

2.2.3. The Calculation of Control Points

In order to simplify the calculation, all the weight factor values ω i are set as 1 in this paper, and ∑ i = 0 n N i , p ( u ) = 1 can be known from the normalization of the NURBS curve. At this point, Equation (1) can be simplified to

C ( u ) = ∑ i = 0 n N i , p ( u ) P i (6)

Establish the following system of linear Equations for the control point P i

Q j = C ( u ¯ j ) = ∑ i = 0 n N i , p ( u ¯ j ) P i ( j = 0 , 1 , ⋯ , n ) (7)

In Equation (7), ∑ i = 0 n N i , p ( u ¯ j ) is the matrix of ( n + 1 ) × ( n + 1 ) coefficients. The parameter u ¯ j and the node vector U can be obtained by using Equations (3)-(5). The B-spline basis function can be obtained by using Equation (2), and the following linear equations can be obtained by substituting into Equation (7)

[ 1 0 0 ⋯ 0 N 0 , 3 ( u ¯ 1 ) N 1 , 3 ( u ¯ 1 ) N 2 , 3 ( u ¯ 1 ) ⋯ N n , 3 ( u ¯ 1 ) N 0 , 3 ( u ¯ 2 ) N 1 , 3 ( u ¯ 2 ) N 2 , 3 ( u ¯ 2 ) ⋯ N n , 3 ( u ¯ 2 ) ⋮ ⋮ ⋮ ⋱ ⋮ 0 0 0 ⋯ 1 ] ⋅ [ P 0 P 1 P 2 ⋮ P n ] = [ Q 0 Q 1 Q 2 ⋮ Q n ] (8)

After solving the control point set { P i } ( i = 0 , 1 , 2 , ⋯ , n ) in Equation (8), A NURBS interpolation curve about the feature data point { Q j } ( j = 0 , 1 , 2 , ⋯ , n ) participating in the interpolation can be uniquely determined.

3. Interpolation Error Calculation of NURBS Curve

An initial NURBS interpolation curve is constructed according to the calculation method of the NURBS interpolation curve calculated in Section 2. However, for data point set { Q s } ( s = 0 , 1 , ⋯ , t − n − 1 ) in the original data point set { Q i } ( i = 0 , 1 , ⋯ , t ) that does not belong to interpolation data point set { Q j } ( j = 0 , 1 , ⋯ , n ) and does not participate in NURBS curve interpolation, interpolation error ε s at all data points Q s should be calculated to verify whether the constraint condition that ε s is not greater than the preset interpolation error ε is satisfied. In order to calculate the interpolation error ε s at each data point Q s , an approximate solution method for the distance from the following point to the NURBS interpolation curve is proposed in this paper.

The first step is to determine the minimum parameter node interval ( u a , u b ) of the node vector corresponding to the data point Q s in the original data point sequence, as shown in Figure 1.

The parameter node interval ( u a , u b ) is divided by step h for R (where R is the number of data points not involved in interpolation between two adjacent characteristic data points), and u r = u a + r h ( r = 0 , 1 , 2 , ⋯ , R ) is taken, where the calculation formula of step h is

h = u b − u a R (9)

Calculate the distance between Q s and C ( u r ) , ε r , take the minimum value in ε r as ε c , and the point on the curve corresponding to ε c as C ( u c ) , as shown in Figure 2(a). The calculation formulas of ε r and ε c are respectively

ε r = | Q s − C ( u r ) | , u a ≤ u r ≤ u b (10)

ε c = min 0 ≤ r ≤ R | Q s − C ( u r ) | (11)

Take parameter u c as the center, and take parameter u c − and u c + on each side (where u c − = u c − h , u c + = u c + h ). Calculate the distance L c − and L c + from data points Q s to two points C ( u c − ) and C ( u c + ) respectively, and take the smaller value of the two as L min .

On the side where L min is obtained (may as well be set as C ( u c + ) ), W parameter nodes are taken to form the parameter interval of ( u c , u c + W ) (The satisfactory accuracy can be obtained if W is 3). The data point Q s is projected to the NURBS curve segment from C ( u c ) to C ( u c + 3 ) , and the projection point is set as C ( u w ) ( w = 0 , 1 , 2, ⋯ ), calculate the distance ε w between Q s and C ( u w ) , take the minimum value in ε w as ε s , and the point on the curve corresponding to ε s as C ( u d ) , as shown in Figure 2(b).

In the parameter node interval ( u c , u c + W ) , R ′ ( R ′ = 10 W ) is divided by step h ′ , and u w = u c + w h ( w = 0 , 1 , 2 , ⋯ , R ′ ) is taken, where the calculation formula of step h ′ is

h ′ = u c + W − u c R ′ (12)

The calculation formulas of the distance between data point Q s and C ( u w ) , ε w and ε s can be respectively calculated as

ε w = | Q s − C ( u w ) | , u c ≤ u w ≤ u c + W (13)

ε s = min 0 ≤ w ≤ R ′ | Q s − C ( u w ) | (14)

Now, the specific algorithm steps of the approximate solution method for interpolation error can be summarized as follows:

l Search the minimum parameter node interval ( u a , u b ) in the node vector corresponding to the data point Q s in the original data point sequence, divide the parameter interval by the step length h calculated by Equation (9) into R equal parts, and obtain the value of each parameter at the equal point respectively.

l The distance ε r between Q s and various points on the curve corresponding to parameter u r is calculated by using Equation (10), and the minimum distance ε c is obtained by combining Equation (11). Meanwhile, the point C ( u c ) and parameter u c on the curve corresponding to ε c are determined.

l Taking parameter u c as the center, one parameter u c − and u c + are taken on each side before and after, to calculate the distance L c − and L c + between Q s and two points C ( u c − ) and C ( u c + ) , and to determine the smaller value L min .

l On the side where L min is obtained, the parameter interval ( u c , u c + W ) is obtained, and the R ′ bisection is performed by using Equation (12), and the value u w ( w = 0 , 1 , 2 , ⋯ , R ′ ) at the same bisection point of each parameter is obtained, respectively. ε w and ε s are calculated by using Equation (13) and Equation (14).

4. Actual Data Calculation Results and Comparative Analysis

In order to verify the accuracy and feasibility of the interpolation error calculation method proposed in this paper, firstly, { Q j } set of data points to be interpolated and a measurement point Q outside the data points are given in this paper. The coordinate of the measurement point Q outside the data points is Q = ( 11 .3929,5 .6180,6 .8010 ) , and the spatial position coordinates of each point are shown in Table 1.

The NURBS curve interpolation method in Section 2 is used to interpolate { Q j } , and the relationship between the interpolated NURBS curve, the interpolated data point { Q j } and the measured point Q is shown in Figure 3.

Using the interpolation error calculation method proposed in this paper, the distance between the measured point Q and the NURBS interpolation curve is calculated by using the existing neighborhood comparison method  and the stepwise scanning method  respectively. The calculation results and calculation time of various methods are listed in Table 2. The theoretical distance in Table 2 is calculated by using UG/NX software.

Data points used to be interpolated to the NURBS curve
The serial numberInterpolate the data point { Q j }
xyz
1 2 3 4 5 6 7 8 9 10 11 120 1.9743 3.9680 5.9108 7.7814 9.5064 11.3929 12.9686 14.7736 16.7677 18.5153 20.00005.6180 5.6180 5.6180 5.6180 5.6180 5.6180 5.6180 5.6180 5.6180 5.6180 5.6180 5.61804.9750 4.7900 4.9110 5.3927 6.0500 5.6537 4.8011 3.8485 3.0845 3.2558 4.1447 5.3626
The results of the three methods are compared
MethodsTheoretical minimum distance: 1.1871 mm
The minimum distance (mm)Time (seconds)
Stepwise scanning method Neighborhood comparison method The proposed method1.7986 1.7881 1.78789.3167 10.4256 12.3928

As can be seen from Table 2, the approximate error solutions can be obtained by the three calculation methods. Among them, the minimum distance calculated by the stepwise scanning method is 0.0115 mm larger than the theoretical minimum distance, but the calculation time is the shortest. The minimum distance calculated by the neighborhood comparison method is 0.0010 mm larger than the theoretical minimum distance, and the calculation time is much longer than that by the neighborhood comparison method. The minimum distance calculated by the method in this paper is 0.0007 mm larger than the theoretical minimum distance and takes the longest time to calculate. However, the actual distance calculated by the method in this paper is closer to the theoretical distance calculated by using UG/NX software, which can more accurately express the error results of NURBS curve interpolation. Therefore, the interpolation error calculation method proposed in this paper is effective in the actual interpolation error calculation process.

5. Conclusion

Solution space for NURBS curve point to the curve of minimum distance problem, this paper puts forward a new type of computing space discrete data points to NURBS curve distance method, and the correctness of the method through examples, and compared with other existing methods, the calculation precision of the method is higher, to reflect the NURBS curve interpolation error and improve the efficiency of iteration has good application value.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

Cite this paper

Chen, L.J., Gao, F., Zhao, B. and Ma, L.F. (2020) Calculation of Space NURBS Curve Interpolation Error. Journal of Computer and Communications, 8, 1-9. https://doi.org/10.4236/jcc.2020.86001

ReferencesLasemi, A., Xue, D. and Gu, P. (2010) Recent Development in CNC Machining of Freeform Surfaces: A State-of-the-Art Review. Computer-Aided Design, 42, 641-654. https://doi.org/10.1016/j.cad.2010.04.002Jahanpour, J., Motallebi, M. and Porghoveh, M. (2016) A Novel Trajectory Planning Scheme for Parallel Machining Robots Enhanced with NURBS Curves. Joumal of Intelligent & Robotic Systems, 82, 257-275. https://doi.org/10.1007/s10846-015-0239-6Ruben, S. and Ettore, B. (2014) NURBS Distance Fields for Extremely Curved Cracks. Computational Mechanics, 54, 1431-1446. https://doi.org/10.1007/s00466-014-1067-4Galvez, A. and Iglesias, A. (2013) Firefly Algorithm for Explicit B-Spline Curve Fitting to Data Points. Mathematical Problems in Engineering, 2013, Article ID: 528215. https://doi.org/10.1155/2013/528215Gofuku, S., Tamura, S. and Maekawa, T. (2009) Point-Tangent/Point-Normal B-Spline Curve Interpolation by Geometric Algorithms. Computer-Aided Design, 41, 412-422. https://doi.org/10.1016/j.cad.2009.02.005Yoshimoto, F., Harada, T. and Yoshimoto, Y. (2003) Data Fitting with a Spline Using a Real-Coded Genetic Algorithm. Computer-Aided Design, 35, 751-760. https://doi.org/10.1016/S0010-4485(03)00006-XPark, H. and Lee, J.-H. (2006) B-Spline Curve Fitting Based on Adaptive Curve Refinement Using Dominant Points. Computer-Aided Design, 39, 439-451. https://doi.org/10.1016/j.cad.2006.12.006Hu, S.-M. and Wallner, J. (2004) A Second Order Algorithm for Orthogonal Projection onto Curves and Surfaces. Computer Aided Geometric Design, 22, 251-260. https://doi.org/10.1016/j.cagd.2004.12.001Stakhov, A. (2005) The Golden Section, Secrets of the Egyptian Civilization and Harmony Mathematics. Chaos, Solitons and Fractals, 30, 490-505. https://doi.org/10.1016/j.chaos.2005.11.022Shopova, E.G. and Vaklieva-Bancheva, N.G. (2006) BASIC—A Genetic Algorithm for Engineering Problems Solution. Computers and Chemical Engineering, 30, 1293-1309. https://doi.org/10.1016/j.compchemeng.2006.03.003Valle, Y., Venayagamoorthy, G.K. and Mohagheghi, S. (2008) Particle Swarm Optimization: Basic Concepts, Variants and Applications in Power Systems. IEEE Transaction on Evolutionary Computation, 12, 171-195. https://doi.org/10.1109/TEVC.2007.896686Jiang, B.C., Han, J. and Xia, L. (2015) Accurate Solution Algorithm of B-Spline Curve Approximation Deviation. Manufacturing Technology and Machine Tools, No. 7, 67-71.Piegl, L. and Tller, W. (2012) The NURBS Book. Springer Science & Business Media, Berlin.He, G.Y. (2002) Visual C++ Common Numerical Algorithm Set. Science Press, Beijing, 528-529.