# A Fast Hole-Filling Method for Triangular Mesh in Additive Repair
## 5 Hole Filling Based on Hole Size
### Large-Sized Hole Filling by Improved Advancing Front Method
Here, we set \(n=round(c_{h}/10)\), in which \(c_{h}\) is the size of the hole boundary vertices. \[e_{l}=\sum_{l=i-1}^{i-n}e_{i,l}\bigg{/}\sum_{l=i-1}^{i-n}\big{\|}e_{i,l}\big{\|},e_{r}=\sum_{r=i+1}^{i+n}e_{i,r}\bigg{/}\sum_{r=i+1}^{i+n}\|e_{i,r}\| \tag{7}\]  
Depending on \(e_{l}\) and \(e_{r}\), their cross product \(n_{e}\) at vertex \(v_{i}\) can be easily determined as \(n_{e}=\frac{e_{l}\times e_{r}}{\|e_{l}\times e_{r}\|}\), as shown in Figure 11b. Until now, a new vector \(n_{e}\) reflecting the topology of the hole boundary has been obtained. In order to make the original normal \(n_{i}\) of \(v_{i}\) tend to \(n_{e}\) smoothly, two weights (\(\alpha,\beta\)) are assigned to \(n_{i}\) and \(n_{e}\) respectively. As a result, the corrected normal \(n_{c}\) can be easily determined by the formula: \(n_{c}=\alpha n_{i}+\beta n_{e}\), where \(\alpha+\beta=1\). **Optimal position determination** In order to make the newly added triangles become more regular and the filling patch assorts with the surrounding mesh well in terms of geometric shape and vertex valence, the optimal 3D coordinates of new vertices should be determined. As shown in Figure 12, the vertex \(v_{i}\) with angle \(\theta_{i}\) (\(75^{\circ}<\theta_{i}\leq 135^{\circ}\)) is chosen as an example to illustrate the determination process in 3D space domain. Specifically, the local curvature and corrected normal of a vertex are combined to define a new weight function for determining the optimal vertex \(v_{o}\). Figure 11: Vertex normal correction. (**a**) Adjacent edge vectors in orange color. (**b**) The corrected vertex normal \(n_{c}\). First, the curvature of the vertex \(v_{i}\) is computed. Due to the good linear characteristics of the Taubin curvature [38] in time and space, we choose it to directly calculate the vertex curvature of \(v_{i-1}\) and \(v_{i+1}\). As mentioned above, the neighboring vertices of \(v_{i}\) should be considered, therefore, the Taubin curvature \(\kappa_{i}(T)\) of \(v_{i}\) is determined by averaging the Taubin curvature of \(v_{i-1}\) and \(v_{i+1}\) instead of direct calculation via the formula below:  
\[\kappa_{i}(T)=\frac{n_{c}Te_{i,i-1}}{\left\|e_{i,i-1}\right\|^{2}}+\frac{n_{c} Te_{i,i+1}}{\left\|e_{i,i+1}\right\|^{2}} \tag{8}\]  
where \(T\) inside \(\kappa_{i}(T)\) is the unit projection vector of the optimal inserted edge \(e_{i,o}\) on the tangent plane \(P_{t}\) of \(v_{i}\). Then, in order to obtain the optimal vertex \(v_{o}\), an initial insertion edge \(e_{i,o}{}^{\prime}\) should be first calculated. As shown in Figure 10a, \(e_{i,o}{}^{\prime}\) should locate on the bisector of the angle \(\theta_{i}\), and its length can be determined by simply averaging the length of \(e_{i,i-1}\) and \(e_{i,i+1}\) via the formula below. \[e_{i,o}{}^{\prime}=l_{ave}(e_{i,i-1}+e_{i,i+1}) \tag{9}\]  
where \(l_{ave}=\frac{1}{2}(||e_{i,i-1}||+||e_{i,i+1}||)\). Once completing the calculation of \(n_{c}\) and \(e_{i,o}{}^{\prime}\), both of them are combined to define a weight function \(F(e_{i,o})\)  
\[F(e_{i,o})=\omega_{1}(\frac{2n_{c}{}^{T}e_{i,o}}{\left\|e_{i,o}\right\|^{2}}- \kappa_{i}(T))^{2}+\omega_{2}\left\|e_{i,o}-e_{i,o}{}^{\prime}\right\|^{2} \tag{10}\]  
where \(\omega_{1}+\omega_{2}=1\). To avoid degenerated triangles when creating new filling triangles, the optimal edge \(e_{i,o}\) is restricted on the plane \(P_{s}\) whose normal is \(n_{s}=\frac{n_{c}\times e_{i,o}{}^{\prime}}{\left\|n_{c}\times e_{i,o}{}^{ \prime}\right\|}\). Then, \(e_{i,o}\) can be defined in polar coordinate form \(e_{i,o}=(l_{ave},\varphi)\) where \(\varphi\) is the angle between \(e_{i,o}\) and \(n_{c}\). Next, \(\varphi\) is calculated by minimizing the just defined weight function \(F(e_{i,o})\). To simplify this calculation process, we set \(A=\omega_{1}l_{ave}\kappa_{i}(T)+\omega_{2}\frac{n_{c}{}^{T}e_{i,o}{}^{\prime}} {\left\|e_{i,o}{}^{\prime}\right\|^{2}}\). In addition, in most cases, due to \(|A|\leq 1\), \(\varphi\) can be calculated by using this formula \(\varphi=\arccos(A)\).