## 1 Introduction  
Reducing machining errors is a common goal for the machining industry. For a three-axis machine tool, there are 21 different geometric errors, including the linear positioning errors for each axis and the angular errors for each axis as well as between two axes [1]. The linear positioning errors are usually caused by the backlash of the ball screws used for the linear axes. The errors can be minimized by calibration with the use of laser interferometry. In addition to the geometric errors, the dynamic errors generated during the machining process also affect the accuracy of machining. The errors are usually caused by the variable cutting forces, machine vibrations, and the uncertain wear of the cutting tools [2]. Generally, the computer numerical control (CNC) controllers of a machine tool cannot cope with these errors. The heat generated during machining can also affect the machining accuracy [3]. In today's industry, the inaccuracy of the free-form surfaces of a machined workpiece can be improved by the following procedure: Perform roughing machining and semi-finishing machining first. For the semi-finishing machining, the excess material, or the stock, will be increased so that there is enough material left for the finishing machining. The average error can be obtained through the measurement, which can be on-machine or off-machine, after the semi-finishing machining. Based on the error, we can modify the tool radius in the computer-aided manufacturing (CAM) software and then regenerate the tool paths for finishing machining. By compensating for the error by modifyingthe tool radius, the tool paths can only be shifted inward or outward by a constant value, and it is not possible to improve the accuracy at a specific location only, as illustrated in Figure 1. As shown in Figure 1b, the profile of the workpiece after semi-finishing machining is different from the target shape shown in Figure 1a. Even if we perform the compensation by tool radius modification as described above, the average geometry may be close to the target geometry, as shown in Figure 1c. However, the local variation cannot be improved. Off-machine and on-machine measurement have advantages and disadvantages. To use off-machine measurement, it is not necessary to consider the measurement error caused by the machine tool itself; however, because the workpiece needs to be unmounted, there will be re-clamping errors. On the other hand, using on-machine measurement needs to rely on the repeatability of the machine tool, but it will not cause re-clamping errors, and can also reduce the time and efforts for re-clamping. At present, the precision of the machine tool is increasing, and the difference between the on-machine and the off-machine measurement is getting smaller. Therefore, dealing with the use of on-machine measurement results for error compensation has become an increasingly important issue. Many error compensation methods have been proposed for free-form surfaces. [PERSON] [4] proposed a method to compensate for systematic errors on the machined surface. A machining pattern model (MPM), which represents the average of several surfaces machined under repeatable conditions, was used as the compensation basis. Regression analysis and spatial statistical methods were used to remove the random effects. The model was then used for reconstructing the computer aided design (CAD) model of the surface. The new cutting tool path can be generated to remove systematic errors. [PERSON] et al. [5] used the spatial independence analysis method to decompose the machining errors measured online into systematic errors and random errors. For systematic errors, the numerical control (NC) codes can be modified for error compensation. [PERSON] et al. [6] used the T-spline surface with local refinement instead of the common non-uniform rational B-splines (NURBS) surface to obtain better accuracy.