# Wall Structure Geometry Verification Using TLS Data and BIM Model
## 2 Building Structures' Geometry Verification
### Plane Segmentation from Point Clouds  
Segmentation is often the first step in gaining information from a point cloud. It means a division of a point cloud into several subsets of points based on predefined criteria. In most cases, the subsets contain points lying on the surface of the same geometric primitive (cylinder, sphere, plane, torus), lying on an irregular smooth surface, or forming edges of objects. The segmentation process, in this case, is the identification of geometric shapes in point clouds, and also the determination of their size, position, and orientation [33]. Based on the used algorithm, methods and approaches for point cloud segmentation can be divided into five groups [34; 35; 36; 37]:  
* Edge-based methods,
* Model-based methods,
* Surface-based methods, region-based methods,
* Clustering-based methods,The algorithm for plane segmentation from point clouds, used in the presented approach, is partially inspired by the region-based segmentation method, while plane parameters are estimated by the least square method. The first step of the algorithm is the selection of a distance threshold. Points that are closer to the estimated plane than the selected threshold, are considered as inliers, and so points that are lying on the surface of the estimated plane. The segmentation process starts by selecting a small number of the nearest points (\(k\)-NN, e.g., 10 points, depending on the point cloud density) to a selected seed point. The seed point is the nearest point of the point cloud to the center point (center of gravity) of the extracted plane from the IFC model. Followingly, the parameters of a plane created by these points are estimated using orthogonal regression, which minimizes perpendicular distances to the estimated plane. The solution is based on the general equation of a plane [38]. The singular value decomposition (SVD) of the matrix of the reduced coordinates is used to calculate the components of the normal vector using (7):  
\[\mathbf{A}=\mathbf{U}\mathbf{\Sigma}\mathbf{V}^{\mathrm{T}}, \tag{7}\]  
where \(\mathbf{A}^{\mathrm{n}\times 3}\) is the matrix of reduced coordinates (reduced to the subsets centroid), \(\mathrm{n}\) is the number of the selected number of neighboring points, the column vectors of \(\mathbf{U}^{\mathrm{n}\times\mathrm{n}}\) are normalized eigenvectors of the matrix \(\mathbf{A}\mathbf{A}^{\mathrm{T}}\), the column vectors of \(\mathbf{V}^{3\times 3}\) are normalized eigenvectors of the matrix \(\mathbf{A}^{\mathrm{T}}\mathbf{A}\). The matrix \(\mathbf{\Sigma}^{\mathrm{n}\times 3}\) is a diagonal matrix with the first three singular numbers of the matrix \(\mathbf{A}^{\mathrm{T}}\mathbf{A}\) on the main diagonal. Therefore, the normal vector of the regression plane is the column vector of \(\mathbf{V}\), which belongs to the smallest singular number of the matrix \(\mathbf{A}^{\mathrm{T}}\mathbf{A}\)[38]. The components of the normal vector are the coefficients \(\mathrm{a}\), \(\mathrm{b}\), and \(\mathrm{c}\) of the general equation of the estimated plane. The coefficient \(\mathrm{d}\) is calculated by fitting the coordinates of the centroid point (\(\mathrm{X}_{\mathrm{mean}}\), \(\mathrm{Y}_{\mathrm{mean}}\), \(\mathrm{Z}_{\mathrm{mean}}\)), and the components of the normal vector to the Equation (8):  
\[\mathrm{d}=-(\mathrm{a}\cdot\mathrm{X}_{\mathrm{mean}}+\mathrm{b}\cdot\mathrm{ Y}_{\mathrm{mean}}+\mathrm{c}\cdot\mathrm{Z}_{\mathrm{mean}}). \tag{8}\]  
Then, the estimated plane model is tested against the selected neighbors, while points lying in this plane (volume defined by the plane and the distance threshold) are identified. This process is performed iteratively, with a gradual increase in the number of points tested. The gradual selection of the closest points for testing is illustrated in Figure 4. It shows the  
Figure 3: Identification of geometry from BIM model—**(1)** BIM model, **(2)** IFC file **(3)** derivation of the wall’s geometry, **(4)** estimation of the parameters of the wall’s surface.