# Path Planning for Laser Cladding Robot on Artificial Joint Surface Based on Topology Reconstruction
## 4 Generation of Laser Cladding Paths
### Generation of the Laser Cladding Interpolation Points
#### 4.2.2 Simplification of the Intersection Data  
It is difficult to directly interpolate curves when a curved surface part is processed using laser cladding. In engineering practice, the polyline, which includes multiple point-to-point line segments, is usually used to approximate the real curve line. The intersection points set directly obtained by the slicing algorithm was large and dense, which could not be directly used as the laser cladding processing point set. If it is directly used, the robot program file will be too large to execute, and the robot control system has to perform the interpolation point by point with extremely low efficiency. Furthermore, a greater degree of alloying and large dilution rate will occur during the laser cladding process when the cladding point set is too dense, which would pollute the composition of coatings and destroy its performance [22; 23]. Therefore, on the premise of processing accuracy, it is essential to simplify the intersection point set and reasonably extract the effective processing points. The arch height error method [24] was introduced into this investigation as an effective mathematical method to optimize the discrete intersection point set.  
The arch height calculation is shown in Figure 8. Known from the previous section, the set of discrete intersection points \(\{P_{i}\}\) was already an ordered sequence. The allowable arch height error \(d\varepsilon\) was the key parameter that affected the number and density of the final interpolation point set, which determined the accuracy and quality of the final cladding path. In this study, \(d\varepsilon\) was usually set as the allowable maximum limit value of defocusing change according to specific laser cladding requirements.  
The general steps for finding interpolation points are described as the following:  
**Step 1:** Assuming that point \(P_{i}\) of the sequence is selected as the starting point, calculate the distance \(d_{i}\)+1 from the point \(P_{i+1}\) to the line \(P_{i}P_{i+2}\).  
**Step 2:** If \(d_{i+1}>d\varepsilon\), it means that the defocusing change exceeds the allowable range, then add \(P_{i+1}\) as the valid interpolation point to the set of interpolation points. If \(d_{i+1}<d\varepsilon\), it means that the defocusing change is within the allowable range, then go to the next step.  
**Step 3:** Connect the \(P_{i}\) and \(P_{i+3}\) points and calculate the distance from the points \(P_{i+1}\) and \(P_{i+2}\) to the line \(P_{i}P_{i+3}\) as \(d_{i+1}\) and \(d_{i+2}\) respectively. The maximum \(d_{max}\) of the collection of \(\{d_{i+1}\), \(d_{i+2}\}\) represents the maximum arch height of the arc segment \(P_{i}P_{i+3}\). If \(d_{max}>d\varepsilon\), then add \(P_{i+2}\) as the valid interpolation point to the set of interpolation points. If \(d_{max}<d\varepsilon\), continue to search forward until the maximum \(d_{max}\) of the collection of \(\{d_{i+1}\), \(d_{i+2}\), \(d_{i+3}\),... \(d_{i+n}\}\) exceeds the allowable arch height error \(d\varepsilon\), then add the point \(P_{i+n}\) as the valid interpolation point to the set.  
**Step 4:** Repeat Step 1-3, while point \(P_{i+n}\) is selected as the new starting point.  
The simplification of the intersection point set usually started with the first point \(P_{1}\) in intersection points set \(\{P_{i}\}\) and ended with the last point \(P_{m}\). Through the above method, all the effective processing interpolation points could be found and outputted as a sequence in the original order.