## 2 Materials and Methods
### Proposed Approach  
The proposed approach aims at overcoming the previous presented issues and, starting from a generic polyline curve, generates a new polyline using a non-uniform offset array. The approach, based on 2D polygons and Boolean union operation, can be summarized in five steps:  
1. Projection: each point of the initial contour is projected (internally or externally as defined) at the assigned offset value along the two normal vectors of the two adjacent segments it belongs to, generating two projecting points.
2. Trapezoid: a trapezoid is created for each segment by connecting the initial contour segment and the offset segment composed by the two projecting points. Since the same normal is considered (i.e., same starting segment) a trapezoid is always created (two right angles).
3. Circular sector: a circle arc is created connecting the two projected points generated by the same initial contour point, the center of the arc. This circle arc along with the projecting lines creates the circular sector. In the case of a multi-point straight line, since projected points of the initial contour point overlap, circular sectors are not computed.
4. Union: Boolean union operation is performed on all the polygons (i.e., trapezoids and circular sectors), and a single polygon is hence created.
5. Offset contour: internal or external boundaries of the Boolean union polygon are then extracted, thus achieving the offset polyline.  
To highlight the working principle of the method, two examples of three points of initial contour are provided for internal (Figure 4) and external (Figure 5) cases. Figure 4a shows the first step of projection for an internal offset: each segment of the initial contour generates two additional projected points, the normal is the same while the magnitude could be different.  
Figure 4: Proposed approach for concave example: (**a**) points (**b**) trapezoid and circle arc (**c**) Boolean union (**d**) results.  
Therefore, starting from an internal point (in this case only the middle one) two points are generated. Figure 4b shows the polygon's generations at step 2 and 3. Trapezoids are created directly connecting the projected points with the original points, while circular sectors are the results of the rotation of one projection segment on the other originating from the same point of the initial contour. Such polygons are merged in the union polygon of Figure 4c using a Boolean union operation. Finally, this last united polygon is used to extract the non-uniform offset as its internal boundary. Such an approach is robust, returns continuous contours and allows for consideration of the generation of multiple contours starting from the initial one, as shown in the examples (Section 3.1). The same procedure is described for the external offset in Figure 5. In this case, at the end of the procedure, after the union polygon is computed (Figure 5c), the external boundary is extracted (Figure 5d).  
The proposed approach has been developed in MathWorks MATLAB using polyshape objects. In variable offset, several points could be needed even for straight lines to achieve the desired non-uniform offset (i.e., each point could require to be offset by a different value). To improve efficiency, in such cases (i.e., same normal points), a single trapezoid-like polygon (i.e., curvilinear trapezoid) is created to be merged subsequently. It is worth pointing out that the proposed method does not aim at computing the machining toolpath, but its goal is to generate the contour of the semi-finished workpiece required to achieve a non-uniform allowance on the part, crucial in case a variable depth of cut is desired (e.g., thin-wall). The machining toolpath to achieve such semi-finished workpiece can be obtained by offsetting the resulting contour (e.g., using a general uniform offset) of the tool radius.  
Figure 5: Proposed approach for convex example: (**a**) points (**b**) trapezoid and circle arc (**c**) Boolean union (**d**) results.