## 2 Methods
### PCA-Based Point-Cloud Data Coordinate System Transformation  
Due to significant variations in the actual tunnel alignment direction caused by engineering requirements, geological conditions, and other factors, the principal feature direction of the tunnel point-cloud data scanned by the laser scanning system is not orthogonal to the XYZ axes of the Cartesian coordinate system. This study selected the Amberg Clearance GRP 5000--Profiler 6012 model mobile 3D laser scanner to collect data, which is a high-precision measurement system designed for tunnel and rail infrastructure inspection. The laser scanning system quickly advances along the tunnel axis to achieve continuous tunnel point-cloud data collection. The actual collected tunnel point-cloud data are shown in Figure 2. Since the tunnel point cloud is a three-dimensional graphic, a single color cannot display the three-dimensional graphic. This study uses a color threshold that is evenly distributed along the point-cloud data to display the three-dimensional point-cloud graphics. The color threshold in the figure has no actual geometric or physical meaning. However, during point-cloud data processing, coordinate system transformation is often involved. To achieve better computational results and facilitate calculations, this study proposes a PCA-based tunnel point-cloud coordinate system transformation method. Figure 1: Method flowchart. Figure 2: Schematic of the original point-cloud spatial distribution (unit: meters) (**a**) XYZ coordinate system (**b**) XY plane (**c**) XZ plane. This method rotates the principal feature direction of the original point-cloud data to align with the z-axis of the Cartesian coordinate system. The results show that this method effectively completes the tunnel point-cloud coordinate system transformation and reduces the errors introduced by manual operations. PCA is a commonly used data feature extraction method that represents the main variation trends of the data by finding the direction with the largest variance (i.e., the principal components). A larger variance indicates that the differences in the data are more pronounced. PCA was first proposed by [PERSON] [59] in 1901. It uses linear combinations to reduce the dimensionality of high-dimensional data to process multivariate data, revealing the correlation between variables and the inherent structure of the data. Later, it was further developed and improved by [PERSON] [60] and named \"principal component analysis\". This method has been widely used in the field of data statistical analysis. [PERSON] [61] et al. successfully extracted the principal axis direction of the turbine-blade point cloud with the help of PCA, proving the effectiveness of the PCA method in extracting the principal component direction of point-cloud data. Based on the above PCA principles and references, this study improves the PCA formula for tunnel point-cloud data processing and applies it to tunnel point-cloud coordinate system transformation. For tunnel point-cloud data with a narrow distribution, this method can effectively extract the principal component direction. Since the actual amount of tunnel point-cloud data is huge, usually counted in millions, it is difficult to directly use tunnel point-cloud data to show the principal component direction of the tunnel point cloud. In order to better demonstrate the PCA principle, this paper uses the sample point-cloud data generated by Python to visualize the PCA principle, as shown in Figure 3. The two arrows in the figure represent the first and second principal component directions of the data. The gray dots are sample data generated by the program, representing the point-cloud data of the actual tunnel. The coordinate axes in the figure are for the quantitative display of point-cloud data and do not have actual units.