## Materials and Methods
### Objective Function  
In order to describe the railway reconstruction problem, the sum of squares for the track lining distance is used as the evaluation index. That is:  
\[F=\sum_{i=1}^{n}\lvert\Delta_{i}\rvert^{2} \tag{1}\]  
where \(n\) and \(\lvert\Delta_{i}\rvert\) are the number of the measuring point and track lining distance of measuring point \(i\), respectively, and \(F\) is the evaluation function. The smaller the \(F\) value is, the higher reconstruction accuracy is. Therefore, the railway reconstruction was presented as an optimization problem. Then, the objective function (\(Q\)) can be calculated from the minimization of the sum of squares for track lining the distance of the measuring point. \[Q=MIN(\sum_{i=1}^{n}|\Delta_{i}|^{2}) \tag{2}\]  
The reconstruction of the existing railway includes two parts: plane reconstruction and longitudinal profile reconstruction. Plane reconstruction is the basis of longitudinal reconstruction, and longitudinal profile reconstruction must be done after plane reconstruction. In addition, because the transition curve exists in in the track plane, the reconstruction of plane reconstruction is more difficult than longitudinal reconstruction. Therefore, this paper focuses on the method of existing railway plane reconstruction. The multiple linear planes were constituted by fundamental railway plane geometry elements, i.e., straight lines, circular curves, and transition curves. In general, the basic curve unit of a typical rail plane is made up of a \"straight line-transition curve-circular curve-transition curve-straight line\" sequence [26], as shown in Figure 2. In the basic curve unit reconstruction model, it is only necessary to obtain the radius of the circle curve and the first and second transition curve to determine the position of the line plane after the first and second intermediate straight lines are confirmed. As the premise of the existing railway reconstruction, an intermediate straight line will directly affect reconstruction accuracy. In a continuous rail plane curve reconstruction model (containing multiple basic curve units), an intermediate straight line is a parameter factor in the existing railway reconstruction model. Figure 1: Flowchart for rail centerline extraction. In the method of total station free-stationing, after the curve-independent coordinate system is established, two points which are rather far away on the straight section are selected to determine the intermediate straight line, or multiple measuring points are selected based on the least squares method. However, when the straight line segment is short or the straight line segment is difficult to determine, this method results in a large error. Moreover, it is difficult to accurately find ZH and HZ from point cloud data, and the track lining distance of the measuring point is also difficult to find directly after existing railway reconstruction. In order to solve the above problems, the sum of the squares for the distance from the point cloud data to the reconstructed track is used as an evaluation parameter in this article, and the segmentation feature of the intermediate straight line is also an important factor. In the straight-line segment, the distance from the point to the straight line is solved using Equation (3). In the segment of the circular curve, the distance can be calculated from the difference between the distance from the center of the circle to the radius (Equation (4)). The common line type of transition curves in China's railways is a cubic parabola, for which it is not easy to find the close form to calculate the distance from the point to the transition curve. Thus, this paper obtains the track lining distance by an iterative method. \[d_{\text{line}}=\frac{kx_{i}-y_{i}+b}{\sqrt{1+k^{2}}} \tag{3}\]  
\[d_{circle}=\left|R-\sqrt{\left(x_{i}-x_{\text{o}}\right)^{2}+\left(y_{i}-y_{ \text{o}}\right)^{2}}\right| \tag{4}\]  
where \(k\) and \(b\) are the slope and intercept respectively, and \(\left(x_{i},y_{i}\right)\) is the coordinate of measuring point \(i\).