# A Coal Mine Excavation Tunnels Modeling Method Based on Point Clouds
## 3 Methods
### Tunnel Centerline Extraction  
The centerline of the tunnel is the center of the space in the tunnel and is usually calculated by computing the mean of the point cloud. However, due to constraints such as the collection environment and methods, the distribution of point clouds in tunnels is often uneven. For example, when collecting tunnel point clouds, the collection path tends to be biased towards one side of the tunnel, resulting in a denser point cloud on that side. This leads to a certain deviation between the calculated mean of the point cloud and the center of the tunnel. Therefore, this paper uses a method based on the convex hull of the point cloud to calculate the centerline of the tunnel, which is not affected by the density of the point cloud distribution.  
First, a series of point cloud slices \(\{S_{i}\}\) are taken along the Y-axis direction of the tunnel and the convex hull \(\{Convex_{i}\}\) of each slice is computed, as the red box shown in Figure 9a. The centroid of the convex hull for each slice is then calculated, and the centroids collectively form the initial tunnel centerline, as the dark line illustrated in Figure 9a.  
It is important to note that the centroid of a convex hull differs from the geometric mean of the convex hull's vertices. The centroid can be envisioned as the center of gravity of a uniformly dense region enclosed by the convex hull. The difference between the centroid and geometric mean of the convex hull is shown in Figure 9b. Due to the larger number of vertices on the right and bottom sides of the convex hull, the mean of the convex hull is biased towards the bottom right. Arranging the vertices of the convex hull in a counterclockwise sequence, with the last point coinciding with the first, the centroid can be computed as follows:  
\[x=\frac{\sum\limits_{i=0}^{n-1}{(x_{i}+x_{i+1})(x_{i}y_{i+1}-x_{i+1}y_{i})}}{ 6A}y=\frac{\sum\limits_{i=0}^{n-1}{(y_{i}+y_{i+1})(x_{i}y_{i+1}-x_{i+1}y_{i})}} {6A} \tag{5}\]  
Figure 8: Completion based on the up-bottom symmetry.  
Figure 7: Completion based on the left-right symmetry.  
where \(A\) represents the area of the convex hull:  
\[A=\frac{1}{2}\sum_{i=0}^{n-1}\left(x_{i}y_{i+1}-x_{i+1}y_{i}\right) \tag{6}\]  
Due to the randomness of the point cloud distribution and the presence of point cloud noise, the initial tunnel centerline may have discontinuities and drift, which need to be further processed and smoothed. By calculating the mean \(\overline{p}\) and standard deviation \(\sigma\) of the X and Z coordinates of the tunnel center points, tunnel center points that deviate significantly from the mean can be filtered out. In this paper, the threshold is set to double the standard deviation, i.e.,  
\[\left\{p_{x}^{i}\Big{|}\Big{|}p_{x}^{i}-\overline{p_{x}}\Big{|}<2\sigma_{x} \right\}\text{ and }\left\{p_{z}^{i}\Big{|}\Big{|}p_{z}^{i}-\overline{p_{z}}\Big{|}<2\sigma_{z}\right\} \tag{7}\]  
Furthermore, the tunnel centerline is further smoothed by polynomial fitting, as shown in Figure 10. Original centerline is shown in blue curve. Using Y as the independent variable, X and Z are fitted separately to obtain the smoothed center point coordinates, as the red curve shown in Figure 10. In this paper, a 10 th-degree polynomial is used for the fitting.  
Figure 10: Tunnel centerline polynomial fitting. (**a**) X-Y fitting. (**b**) Z-Y fitting.  
Figure 9: Method of calculating the centerline of the tunnel. (**a**) Centroid of slices forms the initial centerline. (**b**) Difference between centroid and geometric mean.