## 2 Online 3D Trajectory Generation for Deburring Processing
### Matching the Mathematical Model  
To detect burr distribution through linear contour scanning, mathematical models for curves must be established using cross-sectional contour information to obtain boundary equations. When the processing methods adopted for a target workpiece are known, a CAD model can be used to determine the regions where burrs must be removed. Cross-sectional images of the deburring regions must be obtained to derive the boundary contour curve model. The procedure is described as follows:  
1. The CAD model and target workpiece processing are analyzed to determine the deburring region. In workpieces that have undergone cutting, the deburring region tend to be the processed edges. In those that have undergone casting, the deburring regions tend to include the gates, risers, and parting lines (Figure 2).
2. The cross-sectional images of the deburring regions of the target workpieces along the cutting direction (e.g., the direction of the processed edge or parting lines) are obtained. To remove burrs on gates or risers, bow-shaped loops are used to plan surface-seeking trajectories. The contours are divided into \(n\) segments according to the cross-sectional contour curve characteristics, and the mathematical models for the different curves are determined accordingly. Because the characteristics of distinct cross-sectional boundary contour curves vary, their mathematical models vary. These models may include polynomial boundary curve equations, circular boundary curve equations, elliptic boundary curve equations, parabolic boundary curve equations, and square-ellipse boundary curve equations.
3. The curve fitting errors are calculated and analyzed to determine whether they meet specific values (e.g., a coefficient of determination \(>\) 0.99).
4. For polynomial boundary curve equations, error analyses and model assessments can be performed using the coefficient of determination. Assuming that a dataset includes \(n\) observed values (i.e., \(y_{1},\cdots,y_{n}\)) and that the corresponding model  
Figure 1: 3D online deburring trajectory generation process.  
predicted values are \(f_{1},\cdots,f_{n}\), respectively, the residual is defined as \(e_{i}=y_{i}-f_{i}\), and the mean observed value is defined as \(\overline{y}=\frac{1}{n}\sum_{i=1}^{n}y_{i}\).
* The sum of squares of the observed and mean values are calculated using \(SS_{tot}=\sum_{i=1}^{n}(y_{i}-\overline{y})^{2}\).
* The residual sum of squares of the predicted and observed values obtained using the curve fitting model is calculated using \(SS_{res}=\sum_{i=1}^{n}(y_{i}-f_{i})^{2}=\sum_{i=1}^{n}{e_{i}}^{2}\).
* For polynomial boundary curve equations, the coefficient of determination is \(R^{2}=1-\frac{SS_{res}}{SS_{tot}}\).
* Curve fitting residual plot analyses are performed to verify the accuracy of the residual distribution (Figure 3) according to the following criteria: (1) the residual value must be close to 0; (2) the residual points must be randomly and uniformly distributed between \(-1\) and 1; (3) the residual point distribution must have no consistent pattern; and (4) the residuals must not contain any predictable information.
* The error analysis constraints, residual plot criteria, and minimum order equations comprise the curve-fitting model of the boundary equations.