*3.2. Local Flatness*

The overall flatness of the surface of the initial support of the tunnel can only reflect the overall flatness of a specific section of the tunnel. In a specific tunnel project, the overall flatness of the surface of the first support of the tunnel can only play a qualitative role, but cannot pass a quantitative one. Method to define the leveling degree of the specific local location of the tunnel surface. Therefore, the concept of local flatness is introduced, and the uneven points on the local details of the initial support surface of the tunnel are expressed through the concept of local flatness.

In the traditional method of detecting the surface flatness of the initial support of the tunnel, the 2 m ruler method is generally used to define the flatness: the maximum gap value between the reference plane of the2mruler and the measuring surface. Usually, two points are measured every 200 m, and each point is continuously tested 10 times. According to the qualified rate, it is judged whether the surface flatness meets the measurement requirements. The schematic diagram for defining the flatness of the 2 m leaning rule method is shown in Figure 10.

**Figure 10.** Schematic diagram of flatness definition of 2 m by ruler method.

By referring to the flatness definition method in the 2 m ruler method, this paper introduces the local flatness definition method based on 3DLS technology:

(1) First obtain the three-dimensional distribution map of flatness as shown in Figure 11, where the *X* axis represents the direction of the tunnel's central axis, the *Y* axis represents the direction of the tunnel cross-section, and the *Z* axis represents the normal vector distance of the original point cloud and flatness calculation reference plane. Flatness situation. It can be clearly seen from the three-dimensional map of flatness that the flatness of the tunnel has symmetry along the direction of the tunnel's central axis ( *Y* = 0). The flatness of the left arch of the tunnel is mostly on the negative *Z* semi-axis, and the flatness of the right arch of the tunnel is mostly on the positive *Z* semi-axis.

(2) The flatness data in the Figure constitutes a 3-dimensional scalar field. First, calculate the gradient value of this scalar data point at each point. However, the size of this gradient is of no practical significance to the calculation of local flatness here, because what needs to be known here is only the direction of the gradient. Theoretically, every point on a three-dimensional surface has countless directions that can be changed, and the gradient of each point is calculated only to obtain the direction with the largest change in flatness.

(3) As it is the gradient of a 2-variable function, the value obtained corresponds to the components in the x-direction and the y-direction, which is as follows:

$$\text{grad}(f) = \frac{\partial f}{\partial \mathbf{x}}\mathbf{i} + \frac{\partial f}{\partial y}\mathbf{j} \tag{5}$$

In this way, the direction of the gradient vector can be determined based on the *x* component and the *y* component, and the direction angle of the gradient can also be obtained.

(4) The flatness distribution map drawn according to the normal vector distance is similar to the topographic map. Here we draw on the principle of slope in the topographic map, slope = elevation difference/horizontal distance, in the gradient direction of each point, calculate the slope *i* and the inclination angle. The distance *X* can be adjusted according to the accuracy requirements.

(5) Once the horizontal distance is determined, the height difference between the two points can be known. It can be imagined that a certain point is the center of the circle, the horizontal distance is the radius, and the gradient direction is unique. In the gradient direction, the height changes the fastest, and the highest height difference is obtained when the horizontal distance is constant.

**Figure 11.** 3D diagram of the flatness distribution of the fitting surface after smoothing.

Note: What needs attention here is how to find the corresponding horizontal distance according to the direction of the gradient, as shown in Figure 10 below.

Assume that the red arrow is the direction angle of the calculated gradient vector, and the black dot is the normal vector distance data of a certain point, that is to say, the normal vector distance data is along the red arrow. The direction is the fastest-changing direction (gradient direction). The original coordinates of the point can be identified in Figure 10, and the length *X* along the gradient direction can be expressed as the green point in Figure 12. In the gradient diagram, the horizontal axis represents the direction along the central axis of the tunnel, and the vertical axis represents the direction of the cross-section of the tunnel. The endpoint of the original point gradient direction is the green point, which can be obtained in the two-dimensional coordinate plane.

**Figure 12.** The diagram of the gradient.

(6) To make the definition of local flatness meet the measurement requirements as much as possible and meet the technical specifications of tunnel engineering construction, the introduced three-dimensional laser scanning technology-based tunnel engineering primary surface flatness definition formula is as follows:

$$m\_1 = \frac{h\cos\alpha}{2} = \frac{x\sin\alpha}{2} = \frac{xh}{2\sqrt{h^2 + x^2}}\tag{6}$$

In the formula, *m*1 is the local flatness of the initial support surface of the tunnel, *X* represents the step distance of the original point cloud along the gradient direction, *h* represents the height difference between the starting point and the endpoint of the stepping direction, and *α* represents the inclination angle between the two points.

The schematic diagram of the local flatness definition is shown in Figure 13. The horizontal axis represents the direction of the horizontal step distance *X*, and the vertical axis represents the relative height h between the original point and the endpoint of the gradient direction.

**Figure 13.** Schematic diagram of local flatness definition based on 3DLS technology.
