# 3D Point Cloud Completion Method Based on Building Contour Constraint Diffusion Probability Model
## 3 Methods
### Contour Constraint
#### 3.1.1 Grouping of Building Surface Polygons  
We define a polygon correlation constraint \(E=[F_{Con},\rho]\) to group polygons \(V\) based on the relationships between polygons. The polygon correlation constraint \(E\) is composed of local convexity \(F_{Con}\)[40] and minimum Euclidean distance \(\rho\)[41]. The polygon correlation constraint \(E\) is defined as follows:  
\[E=\left\{\begin{array}{ccc}True&,&F_{Con(V_{i}-V_{j})}=\textit{ convex and }\rho^{(V_{i}-V_{j})}=0\\ False&,&F_{Con(V_{i}-V_{j})}=\textit{concave or }\rho^{(V_{i}-V_{j})}\
eq 0 \end{array}\right., \tag{1}\]  
Figure 1: Point cloud generation diffusion probability model based on building contour constraints.  
Figure 2: Building outline constraint feature extraction module: “\(X^{(0)}\)” refers to the input initial point cloud. “\(V\)” represents the plane polygons extracted by RANSAC. “\(E\)” denotes the polygon-related constraints. “\(\{Z_{1},\cdots,Z_{a}\}\)” represents the grouping of plane polygons. “\(F_{v}\)” is the definition of polygon attributes. “\(R\)” and “\(W\)” are categories defined by plane polygons \(V\), representing the roof and walls, respectively. “\(L^{(R)}\)” denotes the regular edges of polygons projected onto the ground plane \(V_{horizon}\) from both the roof and walls. “\(L^{(W)}\)” represents the regular edges of polygons projected onto the ground plane \(V_{horizon}\) from the walls. “\(S^{(R)}\)” represents the irregular edges of the roof projected onto the ground plane \(V_{horizon}\). “\(C^{(Z)}\)” represents the possible generation area for contour constraints, and “\(X_{c}\)” is the point cloud sampled from it. “\(M^{(Z)}\)” represents the inevitable generation area for contour constraints, and “\(X_{M}\)” is the point cloud sampled from it.  
The local convexity \(F_{Con}\) and minimum Euclidean distance \(\rho\) are defined as:  
\[F_{Con(V_{i}-V_{j})}=\left\{\begin{array}{l}convex\Leftrightarrow\theta_{i}> \theta_{j}\Leftrightarrow\overrightarrow{n}_{i}\cdot\overrightarrow{G_{i-j}}< \overrightarrow{n}_{j}\cdot\overrightarrow{G_{i-j}}\\ concave\Leftrightarrow\theta_{i}<\theta_{j}\Leftrightarrow\overrightarrow{n} _{i}\cdot\operatorname{G}_{i-j}>\overrightarrow{n}_{j}\cdot\operatorname{G }_{i-j}\end{array}\right., \tag{2}\]  
\[\rho^{(V_{i}-V_{j})}=\min\left\{\sqrt{\left(x_{p}^{(V_{i})}-x_{q}^{(V_{j})} \right)^{2}+\left(y_{p}^{(V_{j})}-y_{q}^{(V_{j})}\right)^{2}+\left(z_{p}^{(V_{ j})}-z_{q}^{(V_{j})}\right)^{2}}\right\}, \tag{3}\]  
In the above two equations, \(\overrightarrow{n}\) is the normal vector of the polygon, \(\overrightarrow{G_{i-j}}\) is the vector in the direction from the center of the polygon \(G_{i}\) to \(G_{j}\), and \(\theta=\arccos\left\langle\overrightarrow{n},\overrightarrow{G_{i-j}}\right\rangle\) is the angle between the polygon vector \(\overrightarrow{n}\) and vector \(\overrightarrow{G_{i-j}}\). \(x_{p}\) and \(x_{q}\) represent points on two different edges of the polygons. \(i\
eq j\in\left\{1,2,\cdots,n\right\}\).  
Utilizing Equation (2), we have illustrated a schematic representation of the convex-concave relationships among adjacent polygons in Figure 3.  
Based on the aforementioned polygon correlation constraint \(E=[\rho,F_{Con}]\), the polygons with correlation are merged into an associated group, thereby grouping the building surface polygons \(V\) into \(\left\{\,Z_{1},\cdots,Z_{a}\right\}\).The actual incomplete building point cloud fitting results in plane grouping is shown in Figure 4.