## 2 Method
### Helical Path Generation  
After obtaining the curve contour that undergoes the offset, a multi-axis helical path is generated on this basis. Each layer of the contour holds the coordinates of each point that makes it up and the normal vector corresponding to the point. The normal vectors of the points are the auxiliary vectors used in the previous section to determine whether the constrained curve needs to be inverted. Before articulating each layer as a path, it is necessary to find correspondences between the offset contour and the original contour and between neighboring offset contours. Since the smallest component unit of a contour is a point, it is finding the relationship between points. In the previous method, when finding the corresponding points, it is found according to the nearest distance. There are errors in such an approach, as shown in Figure 10.  
Figure 10: Failure of the closest distance. The closest point is not necessarily the corresponding point in the position relation. Figure 9: Smooth contours. (**a**) Self-intersecting. (**b**) Sawtooth. They should both be eliminated to smooth the contour. To eliminate the existence of errors, an alternative way to find the corresponding points is needed, as shown in Figure 11. The plane formed by the point \(P_{i}\) and the contour tangent vector cuts to the original contour, and the resulting intersection points \(Q_{j}\) and \(Q_{k}\) are used as candidates. The closest point \(Q_{j}\) among the candidates is found as the corresponding point. After finding the corresponding relationship between the contours, a parameter expressing the degree variable is also needed to satisfy the rule that the points are updated in an upward trend. As shown in Figure 12, the distance between the current point and the starting point is gradually increased until the distance reaches the total length of the contour when the starting point is retraced. Therefore, the ratio of the current length to the total length is between 0 and 1, which can be used as a reasonable ratio. It is known that there are \(n\) points on the current contour, and the coordinates of each point are \((x_{P_{i}},y_{P_{i}},z_{P_{i}})\). The length \(L_{k}\) of the position of the \(k^{th}\) point from the starting point is calculated according to Equation (3). And the total length \(L\) can be calculated by replacing the parameter \(k\) by the parameter \(n\). \[L_{k}=\sum_{i=0}^{k-1}\sqrt{\left(x_{P_{i+1}}-x_{P_{i}}\right)^{2}+\left(y_{P_ {i/i+1}}-y_{P_{i/i}}\right)^{2}+\left(z_{P_{i/i+1}}-z_{P_{i/i}}\right)^{2}} \tag{3}\]  
The length ratio is used not only to find the corresponding position of the current point on the neighboring contour but also to determine the distance the current point moves and the angle at which its normal vector is rotated. The principle of generating paths is further elaborated as shown in Figure 13.  
Figure 11: Finding correspondences. (**a**) For same-layer contours. (**b**) For contours of adjacent layers. A set of candidate points is obtained by intersecting the contour lines by a tangent plane. Figure 12: Calculation of the length ratio. A ratio is needed to measure the correspondence and helical transformation. First, let us discuss the situation within the current layer. When obtaining the normal vector \(\overrightarrow{n_{p}}\) on a point \(P_{i}^{\prime}\), if the corresponding point \(P_{c}\) coincides with a point on the original contour, then it is straightforward to let the point \(P_{i}^{\prime}\) inherit the normal vector. Otherwise, it will be on some line segment and then inherit the average sum of the normal vectors of the endpoints of that segment. Then, there is the case between neighboring layers. The corresponding point \(Q_{c}\) found is the target point that the point \(P_{i}^{\prime}\) wants to be close to, and the normal vector \(\overrightarrow{n_{Q}}\) of \(Q_{c}\) and the point \(P_{c}\) are obtained in the same way.