Open Access
 Issue Mechanics & Industry Volume 21, Number 1, 2020 107 13 https://doi.org/10.1051/meca/2019044 07 January 2020

© AFM, EDP Sciences 2019

## 1 Introduction

CAM system has been able to use NURBS curve to describe contour trajectory. NURBS interpolation has also been studied [13] and seems to work well. Many high-end systems have been supporting NURBS curve interpolation, such as FAUNC, Siemens and other manufacturers. However, these CNC systems do not support tool radius compensation for flat NURBS. Generally, the NURBS isometric curve is approximated by numerical approximation in engineering practice [4]. In this paper, we focus on the NURBS tool radius compensation problem for tool geometry path rather than the speed planning and interpolation of NURBS trajectories studied in previous papers.

For that the NURBS isometric curve has applications in many aspects of actual processing, many scholars have conducted research on the calculation of the distance curve. Tiller et al. [5] first offset each edge of the control polygon of original curve to obtain the control polygon of the equidistant curve and then used the resulting control polygon to approximate the equidistant curve of the original curve. Coquillart [6] also calculated the equidistant curve by offsetting the control polygon. Unlike in [5, 6] offset the vertices of the polygon to obtain a new set of control points, and then used the control polygon composed by these new control points to approximate the isometric curve. Hoscheck [7] studied the spline approximation of isometric curve mainly based on parameter optimization and geometric continuity. Klass [8] approximated the isometric curve through the Hermite curve. Pham [9] first calculated the corresponding equidistant curve points according to the sampling points on the original curve, and then obtained the control points of the equidistant curve by fitting these equidistant points with NURBS curve. Lee et al. [10] first approximated the circumference with a certain radius with a quadratic Bezier curve, then used the approximation of the resulting circular curve to sweep along the original curve, and finally expressed the approximation of the equidistant curve as the envelope swept by circular curve. Liu et al. [11] calculated the offset vector of each vertex of the control polygon mainly according to the normal vector curve approaching the original curve, then obtained the new control polygon, and finally calculated the optimal approximation of the equidistant curve using the control polygon. Zhang et al. [12] proposed an approximation algorithm of equidistant curve based on Bezier curve of dual basis. Jiang et al. [13] proposed a specific method of trajectory recognition and transition processing, but too many partial calculations make the algorithm too complicated. The tool-adaptive offset path based on triangular meshes was proposed by Zhou et al. [14] and Kout [15] improved the algorithm with increased nodes and transition paths, but without specific criteria given in error control. Cai et al. [16] gave an improved algorithm for the generation of equidistant curves, which can effectively remove the self-intersection of the equidistant curve but does not give a concrete approach to the control of the error.

In the NURBS trajectory tool radius compensation algorithm, we not only need to consider the calculation of the NURBS equidistant curve, but also need to consider the Intersection of NURBS equidistant curve.

The function of tool radius compensation is to calculate the tool center trajectory, and the tool center trajectory can be regarded as an equidistant curve of the contour trajectory in differential geometry. Therefore, the study of NURBS trajectory tool radius compensation can not be separated from the study of its isometric curve.

The organizational structure of this paper is as follows: Section 1 introduces the state of the art of NURBS equidistant curve; Section 2 presents the tool radius compensation algorithm for single segment NURBS trajectory; Section 3 explains the tool radius compensation algorithm with multi-segment NURBS trajectory; Section 4 discusses the NURBS curve approximation of the NURBS equidistant curve; Section 5 shows simulation and experimental results; and Section 6 concludes this paper. Figure 1 shows the overall flow of the tool radius compensation algorithm.

 Fig. 1Flow chart of tool radius compensation algorithm for complex contour trajectory.

## 2 Tool radius compensation algorithm for single NURBS trajectory

Set the tool radius to be R, then the expression of the original flat NURBS curve is as follows: (1)

The expression of equidistant curve CR(u) = (xR(u), yR(u)) (the default is an internal equidistant curve) is as follows: (2)

The denominator of the NURBS equidistant curve expression contains the root operation, which leads to the result that the NURBS equidistant curve cant be directly expressed as a reasonable form of the original curve. Therefore, only a series of NURBS equidistant position information can be obtained according to equation (2). Fortunately, these isometric points are not isolated data points, so they carry a lot of geometric information. According to the nature of a planar isometric curve, we can see that the coordinate value, the unit normal vector and the relative radius of curvature of any point on the isometric curve can be accurately determined if the parameter expression and the tool radius of the original curve are known.

In the differential geometry, there is no self-intersection phenomenon for the straight lines and arcs, as shown in Figure 2a and b. However, it is possible for NURBS equidistant curve to contain self-intersection, which can lead to overcut of workpiece. To avoid this phenomenon, we need to calculate the self-intersection of the NURBS equidistant curve and then remove the trajectory segments which will lead to overcut. To simplify the calculation of searching the intersection of NURBS equidistant curve, the equidistant curve needs to be discretized. In order to facilitate the processing of CNC machine tools, the NURBS equidistant curve eventually needs to be expressed in a G code form. Taking into account the actual processing needs, NURBS tool center track is finally expressed in two G code forms in our algorithm, respectively the straight line interpolation G code and NURBS interpolation G code. Therefore, the following two points need to be ensured during the discretization of NURBS equidistant curve: discretized small lines need to be smooth to ensure the processing accuracy; and discretized small segments should be as few as possible to improve the efficiency of NURBS tool. To obtain the discrete points of the equidistant curve, firstly we need to discrete the original NURBS curve.

 Fig. 2Tool radius compensation algorithm for single trajectory.

### 2.1 Discretization of the NURBS curve

Since the newly obtained curve expression which obtained by tool radius compensation through normal equidistance is not a NURBS or an explicit curve form. Therefore, in this paper, the method calculates the normal equidistant point and then fits it into a curve.In order to ensure the smoothness of discrete small segments, it is necessary to control the chord error and deflection angles of discrete small segments in a given range. However, if there are too many discrete small segments, it is bound to reduce the efficiency of the intersection of NURBS. Therefore, considering both smoothness and simplicity, this paper proposes an adaptive discretization algorithm.

First, let us analyze the relationship among the radius of curvature, the chord difference and the deflection angle, as shown in Figure 3.

In a circle, the radius of curvature is constant, and if either of the chord and deflection angles is known, then the other can be figured out. According to Figure 3, the relationship among the chord error, deflection angle and the radius of curvature can be established as the following equation (3)

where R is the radius of curvature (mm), E is the chord error (mm), and α is the deflection angle (rad).

Also in a circle, the relationship among the chord length, the chord difference and the deflection angle can also be established, as shown below: (4)

Here, we can calculate the chord length of the next discrete point by equation (4) according to the chord and deflection angle of the last discrete point. However, the focus is how to convert the chord length L to the parameter increment Δu. The specific algorithm is shown below.

Suppose that P(ui)(x(ui), y(ui)) is a point of the NURBS curve, P(ui+1)(x(ui+1), y(ui+1)) is the next point after the discretization. Then, we have

We set ui+1 = ui + Δu, then the following relationship can be obtained according to Taylor expansion: (7) (8)

Δu is very small, so we can remove the high order items and obtain (9) (10)

Substituting equation (8) and equation (9) into equation (5), we obtain (11)

When the curve is discrete, the given chord and deflection angle values should be set as discrete parameters. Substituting the two discrete parameters into equation (3), we can find out the corresponding radius of curvature which is called the critical radius of curvature Rcri.

Since the radius of curvature of the curve is not a fixed value, in order to obtain the chord length from the next discrete point, it is necessary to obtain the corresponding chord and deflection angle first. Therefore, the curvature radius value of the discrete points on the curve is first calculated before the curve is discretized, and then compared to the critical radius of curvature Rcri. We set the given chord difference as E0, and the given deflection angle as α0. In order to obtain the chord length corresponding to the next discrete point, it is necessary to determine the values of the chord error and deflection angle corresponding to this chord length. We consider the following three cases:

Case 1: R > Rcri, E = E0, α < α0

Case 2: E < E0, α = α0

Case 3: R = Rcri, E = E0, α = α0

Since the probability of the third case is very small, the third and first cases can be merged, which does not affect the results of the calculations. Finally, the obtained E and α can be taken into equation (4) to get the next step chord value, then we can obtain Δu according toTaylor expansion. Therefore, the NURBS curve can be discretized, and the specific steps of the algorithm are as follows:

Step 1: Calculate the radius of curvature Ri of a point Pi(i = 0, 1, 2, …, n) on the NURBS curve and then compare to the critical radius of curvature Rcri. If Ri >Rcri, then go to step (2), otherwise, go to step (3).

Step 2: Calculate the curvature radius Ri corresponding to the chord error Ei and deflection angle αi, and set Ei=E0, αi = π− 2acrsin(1 − E0Ri). Then go to step (4).

Step 3: Calculate the chord error Ei and deflection angles αi corresponding to the radius of curvature Ri, and set αi=α0, Ei=Ri(1 − sin((πα0)∕2)). Then go to step (4).

Step 4: Calculate the chord length Li from the next discrete point according to equation (4), and then find out the corresponding parameter step Δui according to equation (10), and the next discrete point parameter is obtained by ui = ui + Δui. Then go to step (5).

Step 5: Examine whether or not the actual chord difference and the deflection angle value corresponding to the obtained discrete points satisfy the condition. If not, let it satisfy the given range by shortening the parameter step. Then go to step (6).

Step 6: Examine whether ui ≤ 1 is satisfied. If yes, then go to step (1), otherwise stop the discretization process.

We can get NURBS scattered points that meet the requirement according to the above adaptive algorithm. Set the chord error E0 = 0.001 mm, deflection angle = 1 degree, and tool radius = 2 mm, Discrete MATLAB simulation is shown in Figure 4a, The deflected angle and the chord error after discretization is shown in Figure 4b, in which the discrete actual chord and deflection angles are within the set range.

 Fig. 3Chord length, deflection angle and radius diagram in a circle.
 Fig. 4Star NURBS curve and its isometric curve discrete simulation.

### 2.2 Self-dealing of NURBS equidistant curve

In the process of calculating the NURBS equidistant curve, if the relative curvature of a part of the original curve is opposite to the relative curvature of its isometric curve, then the equidistant curve will contain self-intersection [17, 18], which is called the first type self-intersection in this paper, as shown in Figure 5. If the original curve trajectory contains a "gourd mouth" shape, then the self-intersection phenomenon will also probably occur in this area, which is called the second type self-intersection in this paper, as shown in Figure 6. When calculating the tool center trajectory of the NURBS contour trajectory, if we fail to identify above two types of self-intersection phenomenon,then it may lead to the overcut of workpiece.

Before eliminating the self-intersection part of NURBS equidistant curve, we should first identify which part of the trajectory will lead to the overcut of workpiece and find out the intersection point of the effective trajectory and the invalid trajectory. For the case that each trajectory is continuous from the starting point to the end point, both types of self-intersection have a same feature, i.e., the trajectory part which leads to overcut is a ring circuit. As shown in Figures 7 and 8, both the starting point and the end point of the NURBS equidistant trajectory corresponding to curve r2 (t) are the same point O. Here, we call this loop track as self-intersection loop track. And the key point to deal with self-intersection is to identify the self-intersection loop track and eliminate it. After we deal with the self-intersection phenomenon, the actual effective tool center trajectory becomes continuous.

No matter which type of self-intersection, before we deal with it, we first need to find out the intersection point. To facilitate the process of finding the intersection point of NURBS equidistant curve, a series of small straight lines are used to describe the NURBS equidistant curve. Therefore, it is vital in our algorithm of dealing with the self-intersection phenomenon to find which two straight lines intersect with each other, and then find the intersection. We first analyze the relative position of any two straight segments on the plane, then the necessary condition for the intersection point of any two straight segments is that both the intersections of their x and y fields are not null. With this condition, we can quickly locate the position of the intersection point.

When self-intersection occurs in NURBS equidistant curve, the intersection point can be determined by the following steps:

Step 1: Store data of the discrete points and their corresponding equidistant points into the array container;

Step 2: Let Linei = Cd(ui)Cd(ui+1) (i = 0, 1, …, n − 1) be a reference line segment, and Linei = Cd(ui)Cd(ui+1) (j = i + k, k = 1, 2, …, n − 1 − i) be a line segmentfor comparison, and compare the first baseline line segment with all subsequent straight lines and examine if there is an intersection: if not, then continue to detect if there is an intersection for the next reference line segment; otherwise, record the bit of the line segment where the intersection is, and then by the infinite separability of equidistant points and the binary iterative algorithm, we can compute the intersection of the equidistant curve and the corresponding parameter un and um (un < um) of the original NURBS curve with a very high precision.

After determining the position of the line segment where the intersection is located and its corresponding original NURBS curve parameters un and um, we also need to determine which side of the intersection is the effective trajectory, and which side needs to be removed. As shown in Figure 9, the intersection of NURBS equidistant curves is the point O, which is the intersection of equidistant curve segments Cd(ui)Cd(ui+1) and Cd(ui)Cd(ui+1), and the corresponding original NURBS curve segments are C(ui)C(ui+1) and C(uj)C(uj+1). And points C(un) and C(um) on the original NURBS curve correspond to the intersection point O. From the direction of the original curve we can obtain that uiunui+1 < ujumuj+1. For the convenience of analysis, we can divide the curve C(u) to three segments by points C(un) and C(um), with the sub-curves C1(u), C2 (u) and C3(u). According to the above analysis, the steps to judge which trajectory segment should be removed are as follows:

Step 1: Calculate the two tangent vectors Tn and Tm of the intersection O, which are respectively equal to the tangent vectors of points C(un) and C(um) of the original NURBS curve. Step 2: If the dot product of vector and tangent vector Tm is negative and the dot product of vector and tangent vectors Tn is positive, then we should eliminate the equidistant curve corresponding to the original NURBS curve whose parameter satisfies u ∈ (un, um).

Above all, to achieve tool radius compensation for single-segment smoothing NURBS curve, we not only need to calculate the equidistant curve of original NURBS curve, but also need to detect if the equidistant curve contains self-intersection phenomenon, and we need to do different treatments for different self-intersection types. This is the biggest difference between it and tool radius compensation algorithm for straight line and arc trajectory.

The contour trajectory of Figure 10 is a 3-order NURBS curve. Suppose that the tool radius is 2mm, we do right tool radius compensation for it, and the resulting tool center trajectories is shown in Figure 10a. Figure 10b shows tool center trajectories after the treatment of self-intersection phenomenon. Comparing these two figures, the tool radius compensation algorithm for single smooth NURBS curve segment introduced in this section is proved to be effective.

 Fig. 5First type of self-intersection of NURBS normal equidistant curve.
 Fig. 6Second type of self-intersection of NURBS normal equidistant curve.
 Fig. 7First type of self-intersection.
 Fig. 8Second type of self-intersection.
 Fig. 9Self-intersection loop track.
 Fig. 10Order butterfly NURBS equidistant trajectory self-processing simulation diagram.

## 3 Tool radius compensation with multiple NURBS segments

The overall profile of the machined part is usually made up of multi-segment trajectories, so the compensation between the adjacent tracks is very important in the tool radius compensation algorithm. For multi-segment contours, since the generated tool center trajectory is not continuous at the transition point, the transfer process is required. For shortened type of transfer, in order to avoid the overcut at the transfer segment, we need to find the intersection point. And for elongation type of transfer, to ensure continuity at the transfer segment, the extension or arc transition is needed.

### 3.1 Treatment of two types of transfer

Both the elongation type and the shortening type are determined based on the vector deflection angle and the tool compensation direction of the adjacent trajectories [19]. As the method is now mature and widely used, so we do not repeat it here. The main work of this section is to improve the existing algorithm.

### 3.2 The shortened type tool radius compensation

For straight segments and arc trajectories, there is only one intersection at the transition, the shortened type tool radius compensation calculation for these two trajectories is relatively simple. Nevertheless, when calculating the shortened type tool radius compensation for the NURBS trajectory, it is also necessary to accurately identify the intersection points required for the calculation to avoid the overcut if there are several intersections at the transition, as shown in Figure 11.

As shown in Figure 11b, it is obvious in this case that the intersection O3 is needed for the tool radius compensation calculation, but not O1 nor O2. In order to improve the efficiency of the algorithm, we have to find the required intersection accurately in the shortest time to simplify the calculation. It can be seen from the third section that the simplification method is also needed when the NURBS equidistant curve is represented by a series of small line segments. When calculating the shortened type tool radius compensation for NURBS curve, the process can be divided into two cases according to the position of the trajectories.

The first case: the previous track is a NURBS curve, as shown in Figure 12 left. In order to find the intersection accurately required for the shortened tool radius compensation, it is necessary to make a positive sequence search for the small line segments consisting of the NURBS equidistant points. That is, for the equidistant points set Pi (i = 0, 1, …, n), first, we need to determine whether there is an intersection point for small line segment P0 P1 and the equidistant curve of the next trajectory. If the intersection does not exist, we need to go on detecting the next small line segment in accordance with the positive sequence. Otherwise, we need to locate the intersection and calculate the accurate corresponding parameter u for the intersection according to the infinite separability and the binary iterative search method for equidistant points, and then eliminate the trajectory segment which will lead to overcut.

The second case: the latter trajectory is the NURBS curve, as shown in Figure 12 right. For the equidistant points set Pi (i = 0, 1, …, n), first we need to determine whether there is an intersection point for small line segment Pn Pn−1 and the equidistant curve of the previous trajectory. If the intersection does not exist, we need to go on detecting the next small line segment in accordance with the reverse sequence. Otherwise, we need to locate the intersection and calculate the accurate corresponding parameter u for the intersection according to the infinite separability and the binary iterative search method for equidistant points, and then eliminate the trajectory segment which will lead to overcut.

When calculating the equidistant curve at shortened type transfer segment for the adjacent NURBS curve trajectories, it may lead to the overcut of workpiece as shown in Figure 13a if the aforementioned positive or reverse intersection searching algorithm is not used. We can also avoid this situation by using a tool with a smaller tool radius.

 Fig. 11Schematic diagram of shortened type tool radius compensation for NURBS trajectory.
 Fig. 12Searching order to find the required intersection for NURBS curve.
 Fig. 13Tool center trajectory at shortened type transfer segment for the adjacent NURBS curve trajectories.

### 3.3 Tool radius compensation for elongation type transfer segment

For elongated tool radius compensation, the existing processing method only considers the geometric information of the trajectory [19, 20], but ignores some parameter information given by the actual machine processing, such as turning time, tool radius, maximum acceleration for machine tools, and so on. If the information is taken into account when calculating the tool radius compensation, the efficiency of the machining can be improved. For elongation transfer segment, we usually extend the tool center track as shown in Figure 14a to avoid a too long air machining distance. The method is easy to implement, but it will bring two corners in some cases which are ought to reduce the processing efficiency. Another method is to plug in an arc segment, but when the radius of the transition arc is very small as shown in Figure 14b, the machine will run at a very low speed when machining the additional track, which can also lead to a reduction in processing efficiency.

In summary, always using any of the above methods is impractical when calculating the tool center track for elongation transfer type, and the idea in this paper is that we should determine which method introduced above to adopt according to the deflection angle of adjacent tracks α, the tool radius R, the maximum acceleration of machining A, and the turn time is δT.

Suppose that the maximum acceleration of machining is, the turning time is. For extending tool center track method as shown in Figure 15a, the relationship among the turning speed, the acceleration and the turning time can be described as the following equation: (12)

where v1 is the turning speed when extending tool center track (mm/s), ΔT is turning time (s), A is the maximum acceleration for machining (mm/s2), α is the deflection angle of adjacent tracks (rad).

When adopt arc transition as shown in Figure 15b, the relationship among the turn speed v1, the acceleration v1 and the turn time ΔT can be described as the following equation: (13)

where v2 is the turning speed when adopt arc transition (mm/s), A is the maximum acceleration for machining (mm/s2), R is the tool radius (mm).

Which elongation transition method to choose is determined by the deflection angle between adjacent contour tracks. Then, we can obtain the critical deflection angle by combining equation (11) and equation (12): (14)

Comparing α to αcri, the situation can be divided to two cases:

Case 1: α < αcri, the deflection angle of adjacent tracks is relatively small, and to let the turning speed be as big as possible, we choose the extending tool center method.

Case 2: ααcri, the deflection angle of adjacent tracks is relatively large, and we choose the arc transition method.

The contour trajectory in Figure 16 consists of a series of NURBS curves, the validity of the elongation type transfer processing algorithm is verified by the adjacent NURBS curves. In Figure 16a, the tool radius is 2 mm, the maximum acceleration of the machine is 200 mm/s2, and the turning time is 0.5 s. In Figure 16b, the tool radius is 2 mm, the maximum acceleration of the machine is 200 mm/s2, and the turning time is 0.02 s.

According to the comparison of Figure 16a and b, it can be seen that even if the tool radius and the maximum acceleration of the machine are the same for the same trajectory, the difference of the turning time will lead to the difference of the critical deflection angle, so as to change the processing method of the elongation transfer. Moreover, the maximum acceleration and the tool radius can also affect the critical deflection angle. Therefore, changes of these factors may all lead to the change of transition processing method.

 Fig. 14Special situations for elongation transfer type.
 Fig. 15Transition processing for elongation transfer type.
 Fig. 16Compare of two kinds methods

## 4 The NURBS curve approximation of equidistant point

In the third and fourth sections, in order to facilitate the solution of the NURBS equidistant curve intersection problem, this paper describes NURBS equidistant curve with a series of equidistant points. The main task of this section is to denote the NURBS equidistant point in the corresponding NURBS curve form, which facilitates the output of the tool center track. Considering that these equidistant points have accurate curvature information, this section uses the feature point extraction method to express these equidistant points in the NURBS curve form. The algorithm of curve approximation based on feature point extraction can be found in [21, 22].

When self-intersection occurs in the NURBS equidistant curve in Section 3, it is necessary to remove the invalid trajectory in the NURBS equidistant line in order to prevent the over-cut of the workpiece, and then the equidistant curve will contain sharp corners. As shown inFigure 17, the self-intersection point of the equidistant curve is the point O, which corresponds to the points C(um) and C(un) on the original curve, the original NURBS curve to three parts, respectively sub-curve C1 (u), sub-curve C2 (u), and sub-curve C2 (u). And the equidistant curve corresponding to sub-curve C2(u) may lead to the over-cut of workpiece, thus the equidistant curve segment should be removed. In order to output the tool center trajectory in the form of NURBS curve, it is necessary to fit the equidistant curve segment corresponding to the two effective sub-curves C1 (u) and C3 (u) with NURBS curve.

In Section 4, when the NURBS equidistant curve intersects with another NURBS equidistant curve of the adjacent trajectory at the shortened type transfer, to prevent the over-cut of the workpiece at the transition, it is necessary to remove the invalid equidistant NURBS track. As shown in Figure 18, the intersection corresponds to the point C(um) on the original NURBS curve, which divides the original NURBS curve to two sub-curves, respectively C1 (u) and C2 (u). We need toremove the equidistant curve segment corresponding to C2 (u), and then fit the equidistant curve segment corresponding to C1(u) with NURBS curve.

In this paper, we use the approximation of two sets of NURBS equidistant points to illustrate the validity of the curve approximation algorithm based on feature point extraction. The first set of NURBS equidistant points does not have sharp corners, so just one curve is needed to approximate the equidistant points. As shown in Figure 19, there are 2997 equidistant points, and the number of characteristic seed points is 63. In the approximation algorithm, the number of characteristic seed points is the same as the number of control points of the approximation NURBS curve. Figure 19a shows the distribution of the selected feature seed points in the equidistant point. When the approximation error limit is given as δ = 0.005 mm, the number of control points after approximation is 261, as shown in Figure 19b, and the actual biggest approximation error is ɛ = 0.004856 mm; when we set the approximation error limit as ɛ = 0.001 mm, the number of control points after approximation is 495, as shown in Figure 19c, and the actual biggest approximation error is 0.001102 mm.

The second set of NURBS equidistant points contains sharp corners, so the pre-processing is required before the curve approximation, and then the characteristic seed points in each set of the equidistant points corresponding to each trajectory segment are extracted. As shown in Figure 20, the number of the equidistant points is 2204, and the equidistant curve can be divided to four parts: the number of extracted characteristic seed points for the first part is 17, for the second part is 10, for the third part is 10, and for the fourth part is 17. Figure 20a shows the distribution of the selected feature seed points in the equidistant point. When the approximation error limit is given as 0.001 mm, there are 125 control points for the first part, and the actual biggest approximation error is 0.001021 mm, as shown in Figure 20b, there are 64 control points for the second part, and the actual biggest approximation error is 0.001166 mm, as shown in Figure 20c, there are 64 control points for the third part, and the actual biggest approximation error is 0.001224 mm, as shown in Figure 20d, there are 127 control points for the fourth part, and the actual biggest approximation error is 0.001069 mm, as shown in Figure 20d.

Comparing the errors of the two sets of equidistant point approximation, we can see that the approximation algorithm based on feature point extraction needs less control points while satisfying the machining precision compared with the previous approximation algorithm based on node configuration. And the fitting efficiency is also higher for the reason that the previous approximation algorithm has a certain degree of blindness when updating the node vector which will lead to low efficiency.

 Fig. 17Tool center trajectory after self-intersection processing for equidistant curve.
 Fig. 18Tool center trajectory after tool radius compensation with shortened type transition.
 Fig. 19Distribution of the feature seed points in the equidistant point (a), δ = 0.005 mm actual approximation error distribution (b), δ = 0.001 mm actual approximation error distribution (c).
 Fig. 20Approximation error(mm) for NURBS 2206 equidistant points does not have sharp corners.
 Fig. 21Trajectory of the simulation consists of multi-segment trajectories.

## 5 Simulation and experiment of NURBS tool radius compensation

In this paper, the simulation of the algorithm is based on the VERICUT simulation platform and actual machining experiment is based on three-axis CNC machine tools. The feasibility and effectiveness of the NURBS tool radius compensation algorithm introduced in this paper can be proved by the results of simulation and experiment. The VERICUT emulation platform can handle G code in NURBS form, so the input of simulation is G code in the form of NURBS corresponding to the tool center trajectory. Due to the limitations of the experimental conditions, we can not find the CNC machine tools supporting NURBS interpolator, so the tool center trajectory of NURBS is discrete according to the adaptive discrete algorithm in this paper, so that a series of linear segments are obtained for actual machining experiment after discretization.

### 5.1 VERICUT simulation process and result

The trajectory of the simulation consists of straight segments, arcs and NURBS multi-segment trajectories. The processing trajectory in the VERICUT simulation is shown in Figure 22. We perform the left and right tool radius compensation, respectively as shown in Figure 22a and b.

From the simulation results in Figure 22, we can conclude that: no matter whether it is left-handed or right-handed, when dealing with a multi-segment trajectory, the appropriate transition method can be adopted for the elongation type transfer. For example, when the adjacent track deflection angle is relatively large, the arc transition method is adopted, and when the angle is relatively small, the tool center track extending method is adopted. For shortened type transitions, the algorithm can calculate the exact intersection position regardless of how many intersections of the NURBStool center trajectory and the adjacent trajectory, thus avoiding the over-cut phenomenon at the transition.

The tool radius compensation algorithm proposed in this paper has been proved to be effective and accurate in dealing with multi-segment trajectories by simulation. In order to verify the validity of the algorithm when dealing with self-intersection phenomenon for single-segment NURBS trajectories, a 3-order butterfly NURBS trajectory is simulated, and the trajectory of the track in VERICUT is shown in Figure 23. Two groups of comparative experiments were performed: the first sets the tool diameter as 1 mm and the tool radius as 1 mm, and the second sets the tool diameter as 4 mm and the tool radius as 2.5 mm. We perform the left and right two-way tool radius compensation for both sets of experiments, by which we can observe the band changes between the left and right tool center track to analyze the overcut situation. Figure 24a shows the two tool center tracks after machining in accordance with the data provided in the first set of experiment, and Figure 24b shows the result of the second set of experiment.

 Fig. 22Tool radius compensation for multi-segment trajectories.
Table 1

 Fig. 23Tool center trajectory simulation for single segment trajectory.

### 5.2 Actual machining processing examples and results

For the butterfly type NURBS, the rough length, width, and height of the machined parts used in this experiment are respectively 120 mm, 80 mm and 20 mm. Like the previous simulation, we also perform two sets of experiments. We firstly calculate the tool center trajectory for both right and left tool radius compensation according to the tool radius compensation algorithm proposed in this paper, and then load the trajectories into the machine numerical control system. The track after machining is shown in Figure 25.

It can be seen from Figures 24 and 25 that the butterfly-type blade will be formed between thetool center trajectories when the tool cuts the blanks according to the trajectories obtained by the left and right tool radius compensation. For the first set of experiment, the thickness of butterfly-type blade is relatively, reached 1 mm. For the second set of experiment, the thickness of butterfly-type blade is relatively in some locations, this is due to the protection mechanism of the tool radius compensation algorithm to prevent over-cut of the parts and it also illustrates the effectiveness of the tool radius compensation algorithm proposed in this paper.

 Fig. 24Simulation result of single segment trajectory.
 Fig. 25Experiment results for single segment trajectory.

## 6 Conclusion

The NURBS tool radius compensation algorithm introduced in this paper fills the gap of the tool radius compensation for CNC systems which can support NURBS interpolation. The algorithm can directly deal with the contour trajectory containing NURBS, and can output the tool center trajectory in a straight line interpolation G code format or NURBS interpolation G code format based on specific needs.

However, if the contour trajectory contains too many NURBS, the calculation speed of the algorithm will be relatively slow, and research is needed to improve the real-time performance of the algorithm.

## References

1. Q.G. Zhang, R.B. Greenway, Development and implementation of a nurbs curve motion interpolator, Robot. Comput. Integr. Manufactur. 14, 27–36 (1998) [CrossRef] [Google Scholar]
2. J. Li, Y. Liu, Y. Li, G. Zhong, S-model speed planning of nurbs curve based on uniaxial performance limitation, IEEE Access 7, 60837–60849 (2019) [Google Scholar]
3. M.-Y. Cheng, M.-C. Tsai, J.-C. Kuo, Real-time nurbs command generators for cnc servo controllers, Int. J. Mach. Tools Manufact. 42, 801–813 (2002) [CrossRef] [Google Scholar]
4. L. Zhang, H. Wang, Y. Li, J. Tan, A progressive iterative approximation method in offset approximation, J. Comput. Aided Des. Comput. Graph. 26, 1646–1653 (2014) [Google Scholar]
5. W. Tiller, E. Hanson, Offsets of two-dimensional profiles, IEEE Comput. Graph. Appl. 4, 36–46 (2007) [Google Scholar]
6. S. Coquillart, Computing offsets of b-spline curves, Comput. Aided Des. 19, 305–309 (1987) [Google Scholar]
7. J. Hoschek, Spline approximation of offset curves. Springer, Netherlands (1990) [Google Scholar]
8. R. Klass, An offset spline approximation for plane cubic splines, Comput. Aided Des. 15, 297–299 (1983) [Google Scholar]
9. B. Pham, Offset approximation of uniform b-splines, Compu. Aided Des. 20, 471–474 (1988) [CrossRef] [Google Scholar]
10. I.K. Lee, M.S. Kim, G. Elber, Planar curve offset based on circle approximation, Comput. Aided Des. 28, 617–630 (1996) [Google Scholar]
11. L.G. Liu, G.J. Wang, Optimal approximation to curve offset based on shifting control points, J. Softw. 13, 398–403 (2002) [Google Scholar]
12. J. Tiffin, The applications of weighted dual functions of bernstein basis in curve offsetting, J. Compu. Aided Des. Comput. Graph. 23, 1987–1993 (2011) [Google Scholar]
13. Z. Jiang, X. Feng, X. Feng, Y. Liu, Contour-parallel tool-path planning of free surface using voronoi diagram approach, in International Conference on Advanced Computer Theory and Engineering (2010), pp. V1–302–V1–305. [Google Scholar]
14. Z. Bo, J. Zhao, L. Lun, R. Xia, Nurbs curve interpolation algorithm based on tool radius compensation method, Int. J. Product. Res. 54, 1–27 (2016) [CrossRef] [Google Scholar]
15. A. Kout, H. Müller, Tool-adaptive offset paths on triangular mesh workpiece surfaces, Comput. Aided Des. 50, 61–73 (2014) [Google Scholar]
16. T.C. Cai, Y.G. Zhao, Z.J. Wang, X.Y. Liu, The generation algorithm of planar nurbs curve and its offset, Mach. Des. Manuf. 7, 224–227 (2014) [Google Scholar]
17. T.W. Sederberg, S.R. Parry, Comparison of three curve intersection algorithms, Comput. Aided Des. 18, 58–63 (1986) [Google Scholar]
18. R.E. Barnhill, G. Farin, M. Jordan, B.R. Piper, Surface/surface intersection, Comput. Aided Geometr. Des. 4, 3–16 (1987) [CrossRef] [Google Scholar]
19. L.I. Xu-Yu, W.U. Yu-Xiang, Research and implementation of a novel algorithm for tool compensation, Modul. Mach. Tool Autom. Manufactur. Tech. 11, 21–24 (2009) [Google Scholar]
20. H. Sun, D. Fan, A novel algorithm for arc transition tool compensation, China Mech. Eng. (2007) [Google Scholar]
21. H. Park, J.H. Lee, Error-bounded b-spline curve approximation based on dominant point selection, in International Conference on Computer Graphics (2005) [Google Scholar]
22. X. Cheng, W. Liu, M. Zhang, Approximation of b-spline curve of feature points, J. Comput. Aided Des. Comput. Graph. 23, 1714–1718 (2011) [Google Scholar]

Cite this article as: J. Li, Q. Wang, G. Zhong, Planar tool radius compensation for CNC systems based on NURBS interpolation, Mechanics & Industry 21, 107 (2020)

Table 1

## All Figures

 Fig. 1Flow chart of tool radius compensation algorithm for complex contour trajectory. In the text
 Fig. 2Tool radius compensation algorithm for single trajectory. In the text
 Fig. 3Chord length, deflection angle and radius diagram in a circle. In the text
 Fig. 4Star NURBS curve and its isometric curve discrete simulation. In the text
 Fig. 5First type of self-intersection of NURBS normal equidistant curve. In the text
 Fig. 6Second type of self-intersection of NURBS normal equidistant curve. In the text
 Fig. 7First type of self-intersection. In the text
 Fig. 8Second type of self-intersection. In the text
 Fig. 9Self-intersection loop track. In the text
 Fig. 10Order butterfly NURBS equidistant trajectory self-processing simulation diagram. In the text
 Fig. 11Schematic diagram of shortened type tool radius compensation for NURBS trajectory. In the text
 Fig. 12Searching order to find the required intersection for NURBS curve. In the text
 Fig. 13Tool center trajectory at shortened type transfer segment for the adjacent NURBS curve trajectories. In the text
 Fig. 14Special situations for elongation transfer type. In the text
 Fig. 15Transition processing for elongation transfer type. In the text
 Fig. 16Compare of two kinds methods In the text
 Fig. 17Tool center trajectory after self-intersection processing for equidistant curve. In the text
 Fig. 18Tool center trajectory after tool radius compensation with shortened type transition. In the text
 Fig. 19Distribution of the feature seed points in the equidistant point (a), δ = 0.005 mm actual approximation error distribution (b), δ = 0.001 mm actual approximation error distribution (c). In the text
 Fig. 20Approximation error(mm) for NURBS 2206 equidistant points does not have sharp corners. In the text
 Fig. 21Trajectory of the simulation consists of multi-segment trajectories. In the text
 Fig. 22Tool radius compensation for multi-segment trajectories. In the text
 Fig. 23Tool center trajectory simulation for single segment trajectory. In the text
 Fig. 24Simulation result of single segment trajectory. In the text
 Fig. 25Experiment results for single segment trajectory. In the text

Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.

Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.

Initial download of the metrics may take a while.