# A Fast Hole-Filling Method for Triangular Mesh in Additive Repair
## 5 Hole Filling Based on Hole Size
### Middle-Sized Hole Filling by Projection-Based Method
First, all interior edges of the patching mesh, i.e., \((a_{3,5},e_{2,5},e_{1,5})\), are collected as an edge set \(S\) for later edge swapping. For each hole boundary vertex \(v_{i}\), \((i=1,2,...,6)\), a scale factor \(s(v_{i})\) is defined as the average length of the edges that connect to \(v_{i}\) except for the hole boundary edges. Then, in case of each initial filling triangle \(f_{i,j,m}\), its centroid vertex \(v_{c}\) and the corresponding scale factor \(s(v_{c})\gets(s(v_{i})+s(v_{j})+s(v_{m}))/3\) can be calculated. If \(\sqrt{2}\left\|v_{c}-v_{t}\right\|>s(v_{c})\) and \(\sqrt{2}\left\|v_{c}-v_{t}\right\|>s(v_{t})\)\((t=i,j,m)\), triangle \(f_{i,j,m}\) is replaced with three smaller ones \(f_{i,j,c}\), \(f_{j,m,c}\), and \(f_{m,j,c}\). In the same way, the splitting operation terminates until no new triangles created. After completing the splitting operation, all newly created interior edges, such as \(e_{2,17},e_{3,17}\), etc, are also added to the edge set \(S\). 2. Edge swapping. To maintain a Delaunay-like triangulation, edge swapping is necessary after the triangle splitting. The swapping process is: for the two triangles adjacent to one edge, each of the two-mutual vertices of these triangles is checked. Then, the edge needs to be swapped if the vertex lies outside of the circum-sphere of its opposing triangle. As shown in Figure 7b, since \(v_{4}\) lies inside the circumcircle of the triangle \(f_{1,2,3}\) adjacent to the edge \(e_{1,2}\), both \(e_{1,2}\) and \(e_{4,3}\) are swapped. After edge swapping, the triangles \(f_{1,4,3}\) and \(f_{4,2,3}\) become more regular. **Patch fairing** To improve the regularity of the patching triangles and make the filling patch assort with the surrounding mesh well, the 3D coordinates of the refined patching vertices should be faired by using a proper mesh deformation method. In this work, the Dirichlet energy function [37] defined in Equation (2) is selected to achieve the desired shape of the refined patch by minimizing \(\tilde{E}_{\text{M}}\). \[\tilde{E}_{\text{M}}(\text{x})=\iint_{\Omega}\left\|\mathbf{x}_{m}\right\|^{2 }+\left\|\mathbf{x}_{m}\right\|^{2}\text{d}m\text{d}n \tag{2}\]  
Note that a 1D version of Equation (2) will be discussed for making the following contents clearer. We hope to find a function \(f(x):[a,b]\rightarrow\mathbb{R}\) that minimizes the energy function within the \(\text{domain}[a,b]\), and assume that \(f(x)\) actually is the minimizer of \(E(f(x))\). \[E(f(x))=\int_{a}^{b}\left(f(x)_{x}\right)^{2}\text{d}x \tag{3}\]  
Let \(u(x)\) be any function that satisfies \(u(a)=u(b)=0\) and \(u_{x}(a)=u_{x}(b)=0\). Further we consider \(E(f(x)+u(x)\lambda)\) as a function of the scalar parameter \(\lambda\), then this function has a minimum at  
Figure 6: Triangle splitting. (**a**) Before splitting, (**b**) After splitting. Figure 7: Edge swapping. (**a**) Don’t need edge swapping, (**b**) Need edge swapping. \(\lambda=0\). Next, the left-hand side of Equation (3) can be expanded and the derivative of \(E(f(x)+u(x)\lambda)\) with respect to \(\lambda\) is defined in Equation (4). For convenience, we will further write \(u_{x}\) as \(u\) and \(f(x)\) as \(f\). \[\left.\frac{\partial E(f+\lambda u)}{\partial\lambda}\right|_{\lambda=0}=\int_{ a}^{b}2\left(f_{xx}+u_{xx}\lambda\right)u_{xx}dx \tag{4}\]  
Consequently, the right-hand side of Equation (4) has to vanish when \(\lambda=0\). After integrating by parts and exploiting \(u(a)=u(b)=u_{x}(a)=u_{x}(b)=0\) by multiple times, Equation (4) can be transformed into Equation (5). \[\int_{a}^{b}f_{xxxx}=0 \tag{5}\]  
Equation (5) implies that the minimizer of \(E(f)\) is a function whose fourth derivative is always zero within the domain \([a,b]\). Insteading of solving for the \(f\) whose fourth derivative with respect to \(x\) is zero, it can be seen that the Bi-Laplacian of \(f\) is also zero, i.e., \(\Delta f=f_{xx}=0\). Therefore, the condition \(f_{xxxx}=0\) is equivalent to Equation (6).