## 3 Proposed Post Triangular Processing of the Midpoint Interpolation Method
This is because the smaller the \(d\), the closer the path is to the obstacle. Equation (1) converges to 0 when n becomes infinitely large in \(d_{n}\), so epsilon receives only a value greater than 0 (positive number) from the user. \(\varepsilon\) is always greater than \(d_{n}\) when \(n\) is infinitely large. i.e., \(d\) is always smaller than epsilon at some point when \(n\) becomes infinitely large. This can be expressed as Equations (2) and (3) as follows:  
\[\lim_{n\to\infty}d_{n}(q_{i})=\lim_{n\to\infty}\frac{d_{n-1}(q_{i})}{2}=\lim_ {n\to\infty}\frac{d_{0}(q_{i})}{2^{n}}=\lim_{n\to\infty}\frac{C}{2^{n}}=0, \tag{2}\]  
\[\therefore\lim_{n\to\infty}d_{n}(q_{i})=0\,,\,\,\varepsilon>0\to\varepsilon>\lim _{n\to\infty}d_{n}(q_{i}). \tag{3}\]  
However, since optimality and clearance are opposite attributes, the closer \(\varepsilon\) is to 0 as shown in Figure 5, the more similar the path or path length is to the visibility graph, but it is not a smooth path [20]. The farther away it is from 0 (within a significant value where the path is modified), the farther it is from the optimum, but a smooth (kinetic) path is made, so \(\varepsilon\) should be set to a suitable value according to the environment. The following Algorithm 3 shows the pseudocode of the proposed post triangular processing of the midpoint interpolation method. It is mainly composed of the post triangular function (Algorithm 4) and interpolation function (Algorithm 5). The input values of the post triangular processing of the midpoint interpolation method consist of the path \(R\) planned through a path planning algorithm, such as the RRT algorithm, the obstacle area information \(C\), and the threshold value \(\varepsilon\) of the minimum clearance. The \(f_{modify}\) is a variable that determines whether the input path \(R\) has been modified by this method, and if the path is modified even once, the entire process is repeated. If the path modification does not occur in the process of repeating, the algorithm is terminated. \(t\) refers to the index of the currently focused waypoint of \(R\). That is, if \(t\) is 0, it is the starting point, which is the first point of \(R\). Figure 5: Variations according to \(\varepsilon\) values in post triangular processing of midpoint interpolation method (\(\varepsilon\) value of (**a**) \(>\varepsilon\) value of (**b**) \(>\varepsilon\) value of (**c**)): (**a**) When \(\varepsilon\) value is set relatively large; (**b**) When \(\varepsilon\) value is set relatively medium (smooth path); (**c**) When \(\varepsilon\) value is set relatively small (closer to the optimal path). ```
Input:\(R\leftarrow\) path from \(\{RRT/\dots\}\) \(C\leftarrow\) position set of all (measured) boundary points in all (known) obstacles \(\varepsilon\leftarrow\) threshold value of minimum clearance Output:\(R\leftarrow\) modified path \(R\) Initialize:\(f_{modify}\leftarrow\)true Procedure postTriProcOfMidInterpolation Begin  While\(f_{modify}\) Do \(f_{modify}\leftarrow\) false // is the path modified \(t\gets 0\) // index of the currently focused point \(q_{child}\leftarrow\) first point in \(R\) \(q_{parent}\leftarrow\) next point of \(q_{child}\) in \(R\) While not [\(q_{parent}\) is the last point in \(R\)] Do \(q_{m ancestor}\leftarrow\) next point of \(q_{parent}\) in \(R\) if not isTrapped(\(q_{child}\), \(q_{m ancestor}\), C) Then \(R\leftarrow\) postTriangular(\(R\), \(\varepsilon\), \(t\), \(f_{modify}\)) \(11\) Else \(R\leftarrow\) interpolation(\(R\), \(C\), \(\varepsilon\), \(t\), \(f_{modify}\)) \(13\)\(q_{child}\gets t\)-th point in R \(14\)\(q_{parent}\leftarrow\) next point of \(q_{child}\) in R End
```
**Algorithm 3** Pseudocode of Proposed Post Triangular Processing of Midpoint Interpolation Method  
In \(R\), when the first focusing point is \(q_{child}\), the next point of that point \(q_{child}\) is \(q_{parent}\), and the next point of that point \(q_{parent}\) is \(q_{m ancestor}\).