## 2 Materials and Methods
### Toolpath Quality Evaluation  
In industrial practice, the structure of machined surfaces is prescribed in the production documentation, most often using the profile method and parameters defined by EN ISO 4287 [33]. Assessment of the structure of machined surfaces by means of measurements with touch (tip) instruments follows the rules and procedures standardized in EN ISO 4288 [34]. The direction of measurement is usually chosen perpendicular to the direction of the dominant texture or in the direction where the parameters to be evaluated take the highest values. The standards distinguish between nominal surface shape, shape deviation, waviness, and roughness (see Figure 5). The surface quality parameters (Ra, Rz, etc.) are influenced by several factors, such as the cutting geometry of the tool and its state of wear, toolpath offsets in point machining, cutting conditions, the static and dynamic properties of the machine-tool-workpiece system,  
Figure 4: A schematic representation of the contour error evaluation method on a piecewise linear toolpath. The NC code path (dashed black line) is given by the part program, which is either an output of a CAM software, or is computed analytically (as in the case of the testing toolpath presented). In the displayed case, the final surface is a result of moving the tool center point of a spherical milling tool with radius 4 mm along the piecewise linear NC code path. The NC code path serves as an input to the interpolator system. The interpolator system optionally smoothens the toolpath by introducing transition curves and then designs a feedrate profile based on its parameter settings and the geometry of the NC code path. The interpolator toolpath (blue path) is then obtained by sampling the toolpath at a fixed time frequency based on the designed feedrate profile. The magnitude and character of deviations presented in this figure were exaggerated to demonstrate the contour error evaluation method. and tool and workpiece chatter. Next, surface parameters may locally deviate, usually near corners or transitions of surface curvature. From practical experience, it seems that the interpolator settings (such as the type of transition curve used at corners, contour tolerance, and (axial and corner) jerk limits) affect waviness rather than roughness. With a zig-zag machining strategy (which was applied when designing the \"Valley\" toolpath), this is usually most prominent in the dominant direction of the surface texture. Therefore, when looking for a suitable interpolator setting, it seems advantageous to approximate the waviness parameter, especially considering the sampling rate of interpolated data obtained from the control system, which generally does not allow the wavelengths corresponding to the roughness parameter to be captured. Thus, the total variation coefficient (denoted as the \(TV\) coefficient in the following) was introduced in this study to evaluate the quality of the toolpath based on the output of the interpolator. The \(TV\) coefficient of a toolpath segment of total length \(L\) is defined by Equation (1):  
\[TV=\frac{1}{L}\int\limits_{0}^{L}\left|\frac{\mathrm{d}e_{c}(s)}{\mathrm{d}s} \right|\mathrm{d}s \tag{1}\]  
where \(e_{c}(s)\) denotes the contour error (as described in Section 2.4.) at arclength \(s\). Mathematically, the \(TV\) coefficient expresses the total variation in the contour error with respect to the arclength of the toolpath, normalized by the total length of the toolpath. It is a unitless quantity. The contour error function \(e_{c}(s)\) was defined as a piecewise-linear function interpolating the distance values obtained at sampling points of the required toolpath. The \(TV\) coefficient is nonnegative and is zero exactly when the contour error is constant (not necessarily zero) along the whole segment. The \(TV\) coefficient reflects the dynamic behavior of the contour error along the respective toolpath (or its segment), thus serving as a measure of toolpath quality.