## 5 Methods and Algorithms
### Infill Strategy Weighting  
The infill strategies presented can be used in convex polygons (see Figure 14a) in a simple and standardized way. Moreover, in addition to their effect on coverage, they also have an impact on the robot's motion. The graph-based approach analyzes and plans the sub-polygons separately and then, if possible, links them into a continuous path. Each of the polygons can therefore be defined with different infill strategies, different infill orientations and different start and end points. Each individual variation for a single polygon is called an infill object. For each of the identified convex polygons of a decomposed slice, a defined number of infill objects can be created, depending on the infill strategy used. Using a defined-end-zigzag pattern as an example, the number of infill options depends on the number of directly adjacent sub-polygons \(\lambda\) and can be calculated according to Formula(1):  
\[\text{\#Infill-Objects}(\lambda)=4\cdot\lambda\ +\ 8\cdot\frac{\lambda\cdot( \lambda-1)}{2}=4\cdot\lambda^{2} \tag{1}\]  
The first section 4\(\cdot\lambda\) refers to the four possible start- and end-infills. Two adjacent polygons have exactly two common vertices, so each of them can be used as the start (end) of an arbitrary path of which the end (start) point is not important at all. The second section 8\(\cdot\frac{\lambda\cdot(\lambda-1)}{2}\) represents the amount of all possible connection-infills which connect any two common vertices of the given polygon with a different neighbor polygon. The weight that is individually assigned to each infill object is theoretically composed of any number of independent components. At first, the reachability by the robot is evaluated as well as geometric properties of the polygon. In addition to these two aspects, other properties such as the amount of process heat generated along the path and the orientation of the ground cable fixed to the workpiece can be included for each infill object. However, the presented work initially concentrates on the first two components mentioned, since the main objective is to generate a reachable and thus executable path for the robot. All weight components are combined in \(g_{final}\) (Formula (2)). \[g_{final}=g_{reachability}+g_{geometry}\ (+g_{heat}+g_{cable}+...) \tag{2}\]  
Reachability is ensured by checking the reachability of a set of characteristic poses for each sub-polygon and infill object, respectively. First, a reference pose is determined. The position of this pose corresponds to the centroid of the polygon analyzed. The orientation of the corresponding pose is determined by a transformation of the printing plate reference frame according to the following rules:  
* The x-axis corresponds to the main infill direction to be analyzed. * The z-axis corresponds to the layer normal vector. * The y-axis completes the right-handed coordinate system. With the help of an already existing package for solving inverse kinematics in the software framework ROS (Robot Operating System [34]), a solution close to a predefined robot configuration is searched for the reference pose. Only if a valid set of joint angles \(\varphi_{i}\) exists, the full set of characteristic poses is checked. It consists of poses that are composed of all polygon vertices as well as the centroid of the surface. However, three different poses are generated from each polygon vertex by varying the reference frame orientation. In addition to the orientation described for the reference pose (x-axis in infill main direction), two more poses are generated for each vertex, in which the x-axis is rotated around the z-axis by +90\({}^{\circ}\) and \(-90^{\circ}\), respectively, to check both extreme orientations for a standard zigzag type infill (see Figure 15). From the up to eight unique solutions of a standard industrial robot possible for each pose, the one with the smallest Euclidean distance to the reference pose within the joint space is selected.