## 3 Methodology
### Structure Deterioration Identification
#### 3.2.3 Bridge Structure Deformation Detection Based on Point Cloud Data
In the process of segmenting bridge components from point cloud data, the primary objective of component fitting optimization is to accurately describe the shape and position of each component of the bridge using mathematical models. After the point cloud segmentation is completed, local features are extracted for each segmented component to facilitate fitting, with local features including normals, curvatures, etc. Subsequently, based on the feature points and the segmented point cloud data, a preliminary fitting is conducted using the least squares method for plane fitting. Specifically, for the main beams and platforms of bridges, a planar fitting method is chosen in this paper; correspondingly, for cylindrical components such as piers, a cylindrical fitting method is selected. To be specific, for planar fitting, this paper proposes the assumption that the plane equation is as follows:  
\[\text{ax}+\text{by}+\text{cz}+\text{d}=0 \tag{5}\]  
Subsequently, the coordinates of points are extracted from the point cloud data (\(\text{X}_{i},\text{Y}_{i},\text{Z}_{i}\)), and solved using the least squares method: \(\text{A}\cdot\text{P}=\text{B}\), where \(\text{P}=[\text{a},\text{b},\text{c},\text{d}]^{\text{T}}\). The optimal solution that minimizes the error is thus obtained: \(\text{P}=\left(\text{A}^{\text{T}}\text{A}\right)^{-1}\text{A}^{\text{T}}\text {B}\). By  
Figure 10: Segmentation rendering of bridge piers. assuming that the point cloud data \(\left\{\left(x_{i},y_{i},z_{i}\right)\right\}_{i=1}^{n}\), combined with the plane equation \(\mathrm{ax}+\mathrm{by}+\mathrm{cz}+\mathrm{d}=0\), the following matrix is constructed:  
\[\mathrm{A}= \begin{bmatrix}x_{1}&y_{1}&z_{1}&1\\ x_{2}&y_{2}&z_{2}&1\\ \vdots&\vdots&\vdots&\vdots\\ x_{n}&y_{n}&z_{n}&1\end{bmatrix} ,\mathrm{B}= \begin{bmatrix}0\\ 0\\ \vdots\\ 0\end{bmatrix}  \tag{6}\]  
Solving \(\mathrm{P}=\left(\mathrm{A}^{\mathrm{T}}\mathrm{A}\right)^{-1}\mathrm{A}^{ \mathrm{T}}\mathrm{B}\), the parameters \(\mathrm{a}\), \(\mathrm{b}\), \(\mathrm{c}\), and \(\mathrm{d}\) of the plane equation can be extracted. For cylindrical fitting, this paper proposes to first assume the cylindrical equation as \(\left(\mathrm{x}-x_{0}\right)^{2}+\left(\mathrm{y}-y_{0}\right)^{2}=r^{2}\), where \(x_{0},y_{0}\) is the center of the circle, and \(\mathrm{r}\) is the radius. Then, the error function \(\mathrm{E}\) is minimized, and the parameters \(x_{0},y_{0}\), and \(\mathrm{r}\) are obtained by solving the equation system where the partial derivatives are zero. Assuming the point cloud data \(\left\{\left(x_{i},y_{i},z_{i}\right)\right\}_{i=1}^{n}\), combined with the cylindrical equation \(\left(\mathrm{x}-x_{0}\right)^{2}+\left(\mathrm{y}-y_{0}\right)^{2}=r^{2}\), the error function becomes the following:  
\[\mathrm{E}=\sum_{i=1}^{n}\left(\left(x_{i}-x_{0}\right)^{2}+\left(y_{i}-y_{0} \right)^{2}-r^{2}\right)^{2} \tag{7}\]  
Using the least squares method or nonlinear optimization method to solve the equation:  
\[\frac{\partial\mathrm{E}}{\partial x_{0}}=0,\frac{\partial\mathrm{E}}{\partial y _{0}}=0,\frac{\partial\mathrm{E}}{\partial\mathrm{r}}=0 \tag{8}\]  
Finally, the parameters of the cylindrical equation \(x_{0},y_{0}\), and \(\mathrm{r}\) can be extracted. After completing the above work, the parameters of the planar and cylindrical fitting models can be stored in a data structure (such as an array or table). In Matlab (Matlab_R2024a), the \"Isqnonlin\" function is selected, which uses the Levenberg-Marquardt iterative optimization algorithm, combined with gradient descent and Newton's method, to optimize the preliminary fitting results and minimize the distance error between the point cloud data points and the fitting model. Through the above methods and processes, the automatic segmentation and fitting optimization of bridge components in point cloud data can be achieved, obtaining accurate component shapes and positions, and ensuring higher efficiency and precision, which is beneficial for bridge deformation monitoring and health assessment.