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 Interpolation
2.1. A Basic Definition of a NURBS Curve
A p-degree NURBS curve is defined as 
In Equation (1), is the control point of NURBS curve. The number of control points is n + 1, and the lines of all control points constitute the control polygon of NURBS curve. is the weight factor value of the corresponding control point ; is the pth B-spline basis function.
The B-spline basis function is defined in the node vector
(where: , and the number of nodes is m + 1). B-spline basis function can be obtained by de Boor-Cox recurrence formula
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 , let the total chord length be D, then there will be
Then, the parameters corresponding to each data point can be represented as
2.2.2. Node Vector Calculation
Let the node vector be . In order to make the node vector reflect the distribution of well, this paper adopts the method of taking the average value, namely
where U is equal to .
2.2.3. The Calculation of Control Points
In order to simplify the calculation, all the weight factor values are set as 1 in this paper, and can be known from the normalization of the NURBS curve. At this point, Equation (1) can be simplified to
Establish the following system of linear Equations for the control point
In Equation (7), is the matrix of coefficients. The parameter and the node vector 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)
After solving the control point set in Equation (8), A NURBS interpolation curve about the feature data point 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 in the original data point set that does not belong to interpolation data point set and does not participate in NURBS curve interpolation, interpolation error at all data points should be calculated to verify whether the constraint condition that is not greater than the preset interpolation error is satisfied. In order to calculate the interpolation error at each data point , 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 of the node vector corresponding to the data point in the original data point sequence, as shown in Figure 1.
The parameter node interval 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 is taken, where the calculation formula of step h is
Calculate the distance between and , , take the minimum value in as , and the point on the curve corresponding to as , as shown in Figure 2(a). The calculation formulas of and are respectively
Take parameter as the center, and take parameter and on each side (where , ). Calculate the distance and from data points to two points and respectively, and take the smaller value of the two as .
Figure 1. The node interval corresponding to the point.
Figure 2. The node interval corresponding to the point. (a) Calculate the shortest distance from the first point to the curve projection; (b) Calculate the shortest distance from the second point to the curve projection.
On the side where is obtained (may as well be set as ), W parameter nodes are taken to form the parameter interval of (The satisfactory accuracy can be obtained if W is 3). The data point is projected to the NURBS curve segment from to , and the projection point is set as ( ), calculate the distance between and , take the minimum value in as , and the point on the curve corresponding to as , as shown in Figure 2(b).
In the parameter node interval , ( ) is divided by step , and is taken, where the calculation formula of step is
The calculation formulas of the distance between data point and , and can be respectively calculated as
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 in the node vector corresponding to the data point 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 between and various points on the curve corresponding to parameter is calculated by using Equation (10), and the minimum distance is obtained by combining Equation (11). Meanwhile, the point and parameter on the curve corresponding to are determined.
l Taking parameter as the center, one parameter and are taken on each side before and after, to calculate the distance and between and two points and , and to determine the smaller value .
l On the side where is obtained, the parameter interval is obtained, and the bisection is performed by using Equation (12), and the value at the same bisection point of each parameter is obtained, respectively. and 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, set of data points to be interpolated and a measurement point outside the data points are given in this paper. The coordinate of the measurement point outside the data points is , 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 , and the relationship between the interpolated NURBS curve, the interpolated data point and the measured point is shown in Figure 3.
Using the interpolation error calculation method proposed in this paper, the distance between the measured point 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.
Table 1. Data points used to be interpolated to the NURBS curve.
Figure 3. Error calculation diagram.
Table 2. The results of the three methods are compared.
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.
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.
 Lasemi, 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.
 Jahanpour, 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.
 Galvez, A. and Iglesias, A. (2013) Firefly Algorithm for Explicit B-Spline Curve Fitting to Data Points. Mathematical Problems in Engineering, 2013, Article ID: 528215.
 Gofuku, S., Tamura, S. and Maekawa, T. (2009) Point-Tangent/Point-Normal B-Spline Curve Interpolation by Geometric Algorithms. Computer-Aided Design, 41, 412-422.
 Yoshimoto, F., Harada, T. and Yoshimoto, Y. (2003) Data Fitting with a Spline Using a Real-Coded Genetic Algorithm. Computer-Aided Design, 35, 751-760.
 Hu, S.-M. and Wallner, J. (2004) A Second Order Algorithm for Orthogonal Projection onto Curves and Surfaces. Computer Aided Geometric Design, 22, 251-260.
 Shopova, E.G. and Vaklieva-Bancheva, N.G. (2006) BASIC—A Genetic Algorithm for Engineering Problems Solution. Computers and Chemical Engineering, 30, 1293-1309.
 Valle, 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.