# A Layer-Wise Strategy for Indoor As-Built Modeling Using Point Clouds
## 3 Methodology
### Layer Contour Extraction
#### 3.4.2 Contour Extraction
Subsequently, shrinking was stopped when the extended boundary encountered other primitives (see Figure 15d-f). It is noted that the parts fitting to the real primitive would be considered as the determined contour (blue lines). Other parts will be the pending contour (orange dash lines) which might be changed subsequently. Despite the aforementioned situation, there are two extra situations to be checked:  
(1) As depicted in Figure 15c, the projection of \(\ell_{2}\) on current boundary \(e_{curr}\) was fully included, and \(\ell_{2}\) possessed a longer distance to \(e_{curr}\) than \(\ell_{1}\). Therefore, considering the projecting inclusion, we shrunk the current edge (depicted in blue) to \(\ell_{2}\). To sum up, if the projection of farther primitive was fully included into the current extending edge, we shrunk the corresponding part to this farther primitive as a new determined edge. (2) We needed to consider the situation where the shrinking edge would intersect with perpendicular primitives. As shown in Figure 15i, the operating edge \(e_{curr}\) would encounter perpendicular primitives at the red points before arriving the target primitive \(l_{curr}\). To this end, we only adjusted the overlapping parts as shown in the red circle of Figure 15j. The remaining parts would only be shrunk to the intersected points (denoted as red points in Figure 15i). The adjusting result is depicted in Figure 15k. When all primitives in \(L_{a}\) assigned to set \(B\) were processed, we were supposed to obtain a contour consisting of determined edges and pending edges (see Figure 15n,o). According to the previous discussion, most of the sub-contours did not contain the arbitrary linear primitive meaning that the \(L_{b}=\varnothing\). However, in part 1 of Figure 13, the type III primitive did exist. Consequently, a post-processing step was required to deal with such a situation. In practice, in order to create new non-perpendicular edges in the current contour, we linked the endpoints of linear primitives in \(L_{b}\) to their nearest endpoints in \(L_{a}\). After that, the redundant parts would be cut off from the current polygon to determine the final sub-contour. An instance of processing arbitrary primitive is depicted in Figure 16. It is noteworthy that the line with arrows represents the new boundary edge added to the  
Figure 14: Initialization of the bounding box: Assigning linear primitives to the edges of bounding box (the arrows indicate the assigning directions): (**a**) illustrations of the bounding box, (**b**) the primitives assigned to the nearest edges of bounding box. current boundary. Figure 17 shows the results of sub-contours extraction according to the previously discussed shrinking strategy. Figure 15: The process of sub-contour shrinkage: (1) (**a,b**) and (**d–h**): ordinary shrinkage situations; (2) (c): extra situation one; (3) (**i–l**): extra situation two (see the shrinkage strategy); (4) (**m,n**): the extracted boundary of sub-contour: orange dashed lines: the pending edges; blue lines: the determined edges; (5) (**o**): the extracted sub-contour polygon model. Figure 16: Arbitrary primitive processing: Linkage and cutting (the blue line indicates the set of type III primitive—\(L_{b}\)). Figure 17: The results of sub-contours extraction: The extracted contours are rendered in the yellow background (from layer 48). 1–6 indicate the sub-floorplans in the 2D layer. Once we obtain the sub-contours, it is easy to merge them to generate a large contour as the initial contour (see Figure 18a). In general, the sub-contour mergence can be completed through the following steps: (1) Initial mergence, (2) virtual walls' elimination, and (3) connection recovery. The sub-contour extraction generates a closed boundary even there are no underlying linear primitives. Thus, in the joint connections between sub-contours may exist virtual inner walls. Therefore, we eliminate the boundaries on the joint connections between sub-contours (see the red lines depicted in Figure 18b).