## 3 Methodology
### Spaces Division and Extraction
#### 3.3.2 Generation of Wall Candidates
8:\(\{\mathrm{NN}p_{st}\}\leftarrow\mathrm{D}(\{\mathrm{L}\})\), \(\{\mathrm{NN}p_{end}\}\leftarrow\mathrm{D}(\{\mathrm{L}\})\)
9:endfor
10: Set the first line as start line: \(0\rightarrow\{\mathrm{Ls}\}\)
11:for i = 0 to size (\(\{\mathrm{L}\}\)) do
12:if\(\mathrm{M}p_{eu}\left(\mathrm{NN}p_{eu}\mathrm{L}^{sl}\right)\) equal to 0
13:\(\mathrm{tarL}=0\)
14:else
15:\(\mathrm{tarL}=\mathrm{M}p_{eu}(\mathrm{NN}p_{eu}\mathrm{L}^{sl})\)
16:if\(\{\mathrm{Ls}\}\) don't contains \(\mathrm{tarL}\)
17:Then
18:\(\mathrm{tarL}\rightarrow\{\mathrm{Ls}\}\)
19: Calculate the intersection point of two adjacent line and add to points of space boundary
20:\(\mathrm{tempP}\leftarrow\mathcal{L}\left(L^{\mathrm{Ls}^{sl}},L^{\mathrm{tarL}}\right)\)
21:if the angle \(\mathrm{C}\left(L^{\mathrm{Ls}^{sl}},L^{\mathrm{tarL}}\right)\) is less than \(\theta_{th}\)
22:\(p^{\mathrm{tarL}}_{eu}\rightarrow\{p_{iters}\}\), \(p^{\mathrm{L}^{sl}}_{\mathrm{M}p_{eu}(\mathrm{euEP})}\rightarrow\{p_{iters}\}\),
23:else
24:\(\mathrm{tempP}\rightarrow\{p_{iters}\}\)
25:break
26:endif
27:if tarL is equal to 0
28:break
29:endif
30:endfor
31:Return\(\{p_{iters}\}\)
```

**Algorithm 2**Boundary generation algorithm

### Opening Extraction

Because the mobile mapping system needs to enter and exit the rooms, we assume that the doors are opened during the data collection process. Thus, the opening detection problem can shift to how to find the vacancy in the point clouds. Traditionally, most researchers detect the opening by finding the holes of the triangulated model of the wall planes. This approach is unsuitable for data collected in indoor environments due to inevitable occlusion. In this paper, we propose a new noise robustness method based on the properties of convex hull, octrees structure, Euclidean clusters, and the camera trajectory. Figure 8 shows the workflow for generation of the opening components. Because we interactively define the start-end positions for each functional space when entering or exiting doors, we obtain the specific RGB-D frames containing door components from the sequences of functional spaces, as shown in Figure 8. Based on the camera pose and the frame sequences, a colorized point cloud for each door component can be recovered. A plane segmentation method is first used for plane detection and the planes containing doors are derived from vertical planes. To detect the opening from the segmentation planes, a three-step strategy is involved. We first compute the convex hull polygons for the given point cloud \(\text{Ps}_{\text{d}}\), and create a new set of point cloud \(\text{Ps}_{\text{ch}}\) by filling the polygon region with evenly distributed points. Then, the octree structures are constructed for \(\text{Ps}_{\text{d}}\) and \(\text{Ps}_{\text{ch}}\) respectively. With the assumption of vacancy in opening, K nearest neighbor searching is used for detecting the vacancy region between two octree structures and the corresponding point cloud \(\text{Ps}_{\text{inc}}\) are obtained. Finally, Euclidean cluster extraction algorithm is used to divide \(\text{Ps}_{\text{inc}}\) into separated components. The details are descripted as follows:

First, the point cloud containing openings is projected to the best fitting planes of itself. A convex hull algorithm is then used to compute the envelope of the projected planes containing openings. As shown in Figure 8a,b, the algorithm generates convex polygons to represent the area occupied by the given points. The envelope of the detected convex hull is subsequently filled by the evenly distributed points and the point cloud \(\text{Ps}_{\text{en}}\) is generated (Figure 8c). Since the envelope is larger than the original convex hull, the cross number method detailed in Section 3.3.2 is used to determine the inclusion of the point in the convex hull polygon and only the point inside the polygon is added into the new point cloud \(\text{Ps}_{\text{ch}}\).