Extracting 3D Indoor Maps with Any Shape Accurately Using Building Information Modeling Data

: Indoor maps lay the foundation for most indoor location-based services (LBS). Building Information Modeling (BIM) data contains multiple dimensional computer-aided design information. Some studies have utilized BIM data to automatically extract 3D indoor maps. A complete 3D indoor map consists of both floor-level maps and cross-floor paths. Currently, the floor-level indoor maps are mainly either grid-based maps or topological maps, and the cross-floor path generation schemes are not adaptive to building elements with irregular 3D shapes. To address these issues, this study proposes a novel scheme to extract an accurate 3D indoor map with any shape using BIM data. Firstly, this study extracts grid-based maps from BIM data and generates the topological maps directly through the grid-based maps using image thinning. A novel hybrid indoor map, termed Grid-Topological map, is then formed by the grid-based maps and topological maps jointly. Secondly, this study obtains the cross-floor paths from cross-floor building elements by a four-step process, namely X-Z projection, boundary extraction, X-Z topological path generation, and path-BIM intersection. Finally, experiments on eight typical types of cross-floor building elements and three multi-floor real-world buildings were conducted to prove the effectiveness of the proposed scheme, the average accuracy rates of the evaluated paths are higher than 88%. This study will advance the 3D indoor maps generation and inspire the application of indoor maps in indoor LBS, indoor robots, and 3D geographic information systems. obtained using a novel boundary extraction algorithm. The X-Z topological path generation aims to find the 2D topological network from the boundary of projected cross-floor building elements. The obtained 2D topological network is the projection of the 3D topological network on the X-Z plane. X-Z path generation, intersection


Introduction
Indoor maps are the fundamental elements for indoor location-based services (LBS) [1], such as pathfinding in hospitals [2], escape path planning during emergency situations [3,4], and passenger transfer in transport stations [5]. Indoor maps describe the relationships between elements (e.g., objects, regions, or themes) inside a building. A reasonable indoor map model generally enables people to find the shortest path connecting two indoor locations, while avoiding collisions with obstacles [6]. Currently, most individuals have been enjoying the advantages of outdoor LBS such as Google map based on comprehensive outdoor map networks [7], but indoor maps have not been fully developed [8]. Although many applications require indoor maps to provide more powerful functions for end-users, the intelligent generation of indoor maps remains a challenging task due to the complexity of the indoor environment.
Currently, indoor maps are mainly modeled manually [2]. In this category, users firstly investigate the indoor maps of buildings and then input the indoor map data using some map-making tools. This manner is tedious, error-prone, and time-consuming.
Building Information Modeling (BIM) has been widely adopted in the architecture, engineering, construction, operation, and facility management (AECO/FM) industry [9,10]. Since BIM systematically captures multiple dimensional computer-aided design (CAD) information, some studies [8] investigated the schemes for extracting indoor maps from BIM data automatically. Undoubtedly, using BIM data to generate indoor maps automatically can significantly reduce the cost of indoor map collection and lay a foundation for indoor LBS and many other studies and applications.
A complete indoor map should support people and movable facilities not only in reaching passable spaces in the floor-level environment, but also passing through the cross-floor elements (e.g., stair, ramp, and elevator). Therefore, A complete indoor map includes both floor-level maps and cross-floor paths [8]. Floor-level maps can be primarily divided into topological maps [2,4,8,11,12] and grid-based maps [6]. The grid-based map and the topological map are often applied in different scenarios. The grid-based map can identify start and endpoints precisely in a 3D indoor space and enable accurate pathfinding. The disadvantage of the grid-based map is that it may not be efficient when executing a pathfinding algorithm like A-star. the topological map acts oppositely. It is much more efficient to find the shortest path in a topological map. However, identifying start and endpoints correctly is still a challenge in the indoor environment.
Currently, the extraction process of 3D indoor maps mainly exists two problems. Firstly, although many efforts have been made in the extraction of both grid-based indoor maps and topological indoor maps using BIM data, most studies have focused on only one of these types. Secondly, most researchers just generate the indoor maps on a single floor and without considering the floor-shift elements. Some studies [8] have proposed methods to extract the cross-floor path, but the methods cannot extract the paths from some cross-floor components with irregular 3D shapes (e.g., spiral staircase).
This study proposes an automatic scheme for extracting a 3D indoor map with any shape accurately using BIM data. Since the floor-level indoor maps generation using BIM data has been systematically investigated in our previous work [2], this study mainly focuses on cross-floor indoor path generation and proposes a novel cross-floor 3D topological map using a four-step process, which supports the path generation for cross-floor building elements with any 3D shapes. The four steps are X-Z projection, boundary extraction, X-Z topological path generation, and path-BIM intersection, respectively. The combination of the floor-level indoor map and the cross-floor 3D topological path forms the final 3D indoor map. Since the proposed solution generates the 3D indoor map automatically based on the BIM data, it will significantly improve the efficiency and the accuracy of 3D indoor map generation and advance the adoption of indoor maps in indoor LBS applications.
The remainder of the paper is organized as follows. Section 2 discusses the related work. Section 3 presents a short review of floor-level indoor map generation and proposes a cross-floor 3D indoor map extraction method. Section 4 describes the empirical studies. Section 5 discusses the results and limitations of this study, and the last section presents conclusions. The main contribution of this study is to develop a scheme to extract crossfloor paths for various irregular connecting elements between two different floors and then generating a complete 3D indoor map by combining this cross-floor map with a hybrid Grid-Topological floor-level indoor map.

Literature Review
Indoor LBS has been developed in the fields of computer science and engineering for decades. The last decade has witnessed many applications of indoor maps in emergency evacuation simulation. These days the prevalence of BIM also triggers technologies of adoption LBS in the AECO/FM industry [6,9]. The automatic generation of 3D indoor maps receives widespread attention from researchers. A complete 3D indoor map consists of both floor-level indoor maps and cross-floor indoor paths.

Floor-Level Indoor Map Generation Using BIM Data
A floor-level map models the single floor indoor environment to a path network in the 2D space. Currently, floor-level maps can be primarily divided into the grid-based map and the topological map. Afyouni et al. [13]. conducted a comprehensive investigation and discussion on the indoor map models. They divided the indoor map models into two classes: symbolic and geometric spatial models. Both the grid-based map and the topological map are geometric spatial models.

Grid-Based Map
A grid-based map is usually represented by an occupancy grid, in which each cell contains information about the presence or absence of obstacles. The grid-based map can identify start and endpoints precisely in a 3D indoor space and enable accurate pathfinding. The disadvantage of the grid-based map is that it may not be efficient when executing a pathfinding algorithm like A-star [14].
The traditional approaches mainly operated on 2D drawings or images. For example, Lee & Park [15] used drawings and the Bayesian model to generate a grid-based map for the estimation of the mobile robot position. Babu et al. [16] proposed a method to obtain a grid-based map based on images and obstacle detection for autonomous robot development. This method initially captures the unknown environment using a camera and then applies the obstacle detection method to generate a Grid-based map. One disadvantage of these traditional approaches is that they ignored the abundant semantic information of building components. To address this problem, Lin et al. [6] proposed a method to cope with path planning for a 3D indoor space through a BIM model. They firstly extracted both geometric and semantic information of building components defined in the BIM file, and then discretized and mapped the extracted information into a planar grid to generate a grid-based map. Grid-based maps accurately identify starting and ending points. However, location-based services (LBS) are not very efficient, especially in a map with millions of cells. The grid-based map is trivially implemented and can support different kinds of geometric-based queries as well as cell-level interactions. However, dealing with a huge number of cells may exponentially increase traversal time, therefore it will bring performance and scalability problems [17]. Quadtrees [18], PR quadtrees [19], skip quadtrees [20] and concave areas elimination [21] are the current solutions to solve the performance problems.

Topological Map
A topological map is denoted by a set of points and relationships among points [22], where each point is a concrete location in 3D space and each relationship stands for a passable route between two points. The grid-based map and the topological map are often applied in different scenarios. The topological map acts opposite to the grid-based map. It is much more efficient to find the shortest path in a topological map. However, identifying start and endpoints correctly is still a challenge in the indoor environment. Currently, the topological map has been widely used by various context-aware navigation services. Current technologies extracting topological maps mainly include the visibility graph [23], straight skeletons [24], and Generalized Voronoi Graphs (GVG) [25].
A visibility graph consists of a set of visible nodes and edges. A visible node usually denotes an important spatial position such as the vertex of an obstacle, entrance, or exit. An edge formed by two visible nodes is a line that does not intersect with any object in the space. Undoubtedly, the visibility graph is capable to adapt in some indoor LBS [13,26]. However, the path guidance does not conform to the human cognition of a path [4,27,28]. Additionally, the number of edges may grow exponentially with the number of visible nodes [8,25].
The straight skeleton captures the medial axis of geometric shapes [29] and converts the polygon into graphs. Lee proposed the Straight-Medial Axis Transform (S-MAT) algorithm [30], which can generate the acceptable topological map for geometric shapes with simple and relatively regular polygons. Taneja et al. further developed the Modified-Medial Axis Transform (M-MAT) [31] to attack some problems of S-MAT. However, the straight skeleton schemes may generate many unnecessary nodes and bend edges for building components with irregular polygons.
A Generalized Voronoi Graph (GVG) captures the boundary of a Generalized Voronoi diagram (GVD) and replaces the curved lines with straight lines [32]. Delaunay Triangulation (DT) [33], a variation of a GVG, is proposed to avoid both staggering and the emergence of slender triangles. Mortari et al. developed the Improved Geometric Network Model (IGNM) [28] using Constrained Delaunay Triangulation (CDT) and proved the effectiveness of DT. Tsardoulias et al. [34] proposed Approximate Generalized Voronoi Diagram (AGVD) for constructing a topological map. They made several improvements in AGVD to create a topological map for efficient path planning. On top of CDT, Lin et al. [8] suggested a scheme of intelligent generation of indoor topology (i-GIT) for human indoor pathfinding. i-GIT introduces polygon regularization to improve the efficiency of map generation. Teo & Cho [35] proposed a multiple-purpose geometric network model (MGNM) to combine outdoor and indoor paths in this category.
The main disadvantage of the topological map is the disability to achieve as high accuracy as the grid-based models do. Different from the above efforts, Zhou et al. [2] proposed an automatic floor-level indoor map generation scheme from a novel perspective by introducing the image thinning theory [36]. This effort is completely different from the current studies in this area. The proposed floor-level Grid-Topological map maintains the advantages of the grid-based map and the topological map.

Cross-Floor Indoor Path Generation Using BIM Data
The cross-floor indoor path represents the topological network of the cross-floor elements in the BIM model. Currently, although some studies [8] have discussed the automatic generation of the cross-floor indoor paths using BIM data, these methods bring certain limitations and inadaptability when dealing with irregularly shaped cross-floor elements.
Lin et al. [8] proposed a scheme of intelligent generation of indoor topology (i-GIT) for human indoor pathfinding. i-GIT introduces polygon regularization to improve the efficiency of map generation. However, it determines the centerlines/paths of the crossfloor elements by finding the midpoints on both sides. This method cannot be applied to irregular elements like spiral stairs and winding ramps. Teo & Cho [35] proposed a network model that combined outdoor and indoor paths including stairs, but they simplified stair paths by merely connecting the bounding vertices of stair areas without considering the real geometric data of stairs. Lin et al. [6] proposed a method to cope with path planning for a 3D indoor space. They mainly focus on finding the shortest, collision-free path within a single-story space based on the IFC model, without clearly introducing how to process the cross-floor elements. Lin et al. [37] proposed a novel approach to generate high-accuracy stair paths that can support straight, spiral, and winder stairs. To verify the proposed algorithm, they used 54 straight and spiral stairs provided by Autodesk Revit's official website and three self-built winder stairs as test cases. However, they have not evaluated the proposed algorithm in the integrated building models.
This study proposes a four-step process to develop a novel cross-floor path generation scheme. The four steps are X-Z projection, boundary extraction, X-Z topological path generation, and path-BIM intersection respectively. Since the proposed boundary extraction algorithm can prevent the influence of component shape on cross-floor indoor map extraction, our scheme can be utilized to obtain cross-floor 3D maps from building elements with any 3D shapes.

Floor-Level Indoor Map
This section provides an overview of the generation of the floor-level indoor map using BIM data. The main procedures include (1) Information extraction, (2) Discretization and mapping, (3) Grid-based map thinning, and (4) Grid-Topological map generation. Figure 1 shows the procedures of generating the floor-level Grid-Topological map.
(1) Information extraction: A BIM model or an input IFC file captures geometric and semantic information of a building during the life cycle. To generate the grid-based indoor map of indoor building environments, the first issue is how to obtain the internal structure information of buildings. Accordingly, the passable spaces for humans or obstacles can be identified accurately.
(2) Discretization and mapping: Based on the extracted information of indoor building environments, this study discretized the extracted spatial information and mapped them to a planar grid. Then, a grid-based indoor map, which corresponds to the building indoor environments, can be extracted exactly.
(3) Grid-based map thinning: The extracted grid-based indoor map from step (2) is an original grid-based indoor map, which almost represents the indoor environments directly. The original grid-based indoor map encompasses many redundant spatial cells, and they are useless for the generation of the corresponding topological indoor map. Therefore, this study employs the efficient and precise thinning algorithm to thin the gridbased indoor map.
(4) Grid-Topological map generation: As we have acquired the thinned grid-based indoor map, this study identifies the building nodes which obtain specific values and connects the neighboring nodes as the edges. Then, the hybrid Grid-Topological indoor map can be generated by linking the grid-based map and the topological map.  Since the Topological map is generated from the grid-based map, it can be combined to generate a hybrid map, termed Grid-Topological map. The Grid-Topological map enables users to identify any point in the building accurately and compute the shortest path efficiently. Figure 2 illustrates the above-mentioned procedure of generating the floorlevel Grid-Topological map with an example. In Figure 2a, the building elements are extracted and projected into a plane with N×N grids. Figure 2b shows the grid-based map by discretizing and mapping all building elements on the grid plane. The gray grids are occupied, while the white ones are passable. The topological map is obtained by thinning the passable grids. The left grids are marked as red in Figure 2c. The thinned grid-based indoor map is processed by topological linking. Figure 2d shows the Grid-Topological map, which jointly includes both the grid-based map and the topological map.

Cross-Floor Indoor Path Generation
The cross-floor indoor path is a fundamental part of a complete 3D indoor map. Cross-floor building components are the connecting elements between two different floors. Stairs and ramps are the most typical cross-floor building elements in the BIM model. The conventional stairs contain straight stair, turn stair, L-style stair, n-style stair, m-style stair, and spiral stair. Straight ramp and curved ramp are two typical ramps. Extracting the topological path from the cross-floor building elements is an effective manner to build the cross-floor indoor path.
Recently, some studies [8] have attempted to extract the cross-floor indoor paths from cross-floor elements directly. They found and connected the midpoints in the boundaries of the cross-floor components. Admittedly, this solution can generate topological maps from cross-floor elements with regular shapes. However, for the cross-floor building elements with irregular shapes like spiral stairs, this solution cannot obtain the correct crossfloor 3D indoor maps. Therefore, the automatic generation of topological paths from 3D building elements with irregular shapes remains a challenging task. To address this problem, this study proposes a novel solution to generate the cross-floor indoor paths from cross-floor elements with any 3D shapes.
This study uses a four-step process to abstract the 3D topological path from a crossfloor element with any shapes, namely X-Z projection, boundary extraction, X-Z topological path generation, and path-BIM intersection. The X-Z projection uses the top-down view to map the 3D shapes of a cross-floor building element into the X-Z plane. The boundary extraction obtains the boundary from the X-Z projection image using a novel boundary extraction algorithm. The X-Z topological path generation acquires the topological path of the extracted boundary as a 2D topological path. The path-BIM intersection captures the final 3D topological map by intersecting the 2D topological path with the 3D shapes of the cross-floor elements in BIM. Figure 3 shows the whole steps of the 3D topological map generation from a cross-floor building element.
Curved stair X-Z projection Boundary extraction X-Z topological path generation path-BIM intersection Figure 3. A four-step process for the generation of a 3D topological path from a cross-floor element.

X-Z Projection
X-Z projection projects the 3D shapes of a building element into the X-Z plane from the negative direction of the Y-axis. This subsection describes the details of the X-Z projection.
To form the projected cross-floor elements understandably, this subsection first presents the coordinate settings in the BIM environment. Figure 4 shows the 3D coordinate settings, which consist of three axes, x-, y-and z-axis. As with the 2D coordinates, the xaxis is horizontal, and the y-axis is vertical, and in a 3D environment, the z-axis is the depth. As shown in Figure 4, the x-axis, y-axis, and z-axis are represented by red, blue and green lines, respectively. When y = 0 (or other fixed value), an X-Z plane is obtained. Similarly, an X-Y plane is a 2D plane where z = 0 or other fixed value, and a Y-Z plane means a 2D plane with x = 0 or other fixed value.
After the 3D coordinate is set in the BIM environment, the X-Z projection is converted into mapping the 3D shapes of a cross-floor building element into the X-Z plane. The projected cross-floor building elements on the X-Z plane can be obtained by setting y = 0 for all the points/lines/faces in its 3D shapes. That is, a point (x1, y1, z1) in the 3D shapes is set as (x1, 0, z1) during the X-Z projection procedure.

Boundary Extraction
Boundary extraction extracts the edges of the projected cross-floor elements. To fluently explain the boundary extraction problems, we have the following definitions of the related terms and select the spiral stair as an example to illustrate the boundary extraction process.

Definition 1 (Cross-Floor Building Element).
A cross-floor building element C is a connecting element between two different floors in the BIM model. Since a building element in the BIM model is usually composed of a series of triangles, t1, t2, …, tn. Thus, we have

Definition 2 (X-Z Projection). The X-Z projection, C T , is the projection image of a cross-floor building element C. The X-Z projection is obtained by mapping the 3D shapes of the cross-floor building element into the X-Z plane.
All the faces of the cross-floor building element can be represented by a set of triangles. To obtain the X-Z projection image of the cross-floor building element, this study sets y = 0 for all the faces of building element C in the 3D coordinate system. Thus, we have This study obtains the X-Z projection image from these eight types of cross-floor building elements and finds that the X-Z projection image of a cross-floor building element has no overlapping part. We have the following observation.

Observation 1. The X-Z projection image C T of a cross-floor building element is a 2D closed image, and there is generally no overlapping part.
A cross-floor building element C connects two different floors, then the 3D shapes of the cross-floor building element C most intersect with the slabs of two different floors. The X-Z projection image C T is obtained by projecting the 3D shapes of the cross-floor element C from the top-down view. The intersection lines of the cross-floor building element and the slabs are then projected on the X-Z plane too, and the projected intersection line is a part of the boundary. Figure 5 illustrates the intersection lines between the slabs and the spiral stair.

Definition 3 (Boundary of the X-Z projection).
The boundary of the X-Z projection image, denoted as b, is composed of a set of edges, and each edge ei is a side of the projected triangle. Thus, b = (e1, e2, ..., em).
To extract the boundary of the X-Z projection, this study proposes a novel scheme to collect all the edge lines and extracts the complete boundary b finally. Corollary 1. If a short line in the X-Z projection image is a boundary line ei, then the adjacent line ei+1 has the maximum turning angle with the boundary line ei. Namely, for a certain vertex in the boundary of the X-Z projection, the maximum turning angle exists between two adjacent boundary lines ei and ei+1.
Proof. Figure 6 presents a plane geometric graphic that is composed of a series of triangles. The red lines make up the whole boundary of the plane geometric graphic, and points p1, p2, …, and pk locate on the boundary lines. For point p1, there are k − 1 vectors starting from it.□ Definition 4 (Turning Angle). The turning angle θ is the angle between vector p1p2 and any other vector that takes point p1 as its vertex. The value range of the turning angle θ is from 0 to 2π.
There are k − 2 turning angles between vector p1p2 and any other vector that takes point p1 as its vertex, and the values of these turning angles have a regular pattern that θk > θk−1 > … > θ3. Thus, for the certain point p1 in the boundary, the maximum turning angle exists between two adjacent boundary lines. According to Corollary 1, for a certain point in the boundary lines, the turning angle between two adjacent boundary lines has the largest value. Then, this study extracts all the edge lines of the boundary by referring to Corollary 1. Figure 7 illustrates the boundary extraction process of a spiral stair. Figure 7a presents the X-Z projection image of a spiral stair. The X-Z projection image is composed of a series of triangles. The 3D shape of the spiral stair intersects with the slabs of different floors, and the projected intersection line is a part of the boundary. As shown in Figure 7b, the edge e1 is one of the projected intersection lines. This study starts extracting boundary lines from edge e1. The endpoints of edge e1 are denoted as p11 and p12. For the endpoint p11, there are two vectors, one of the vectors can be represented by p11p12 and another can be represented by p11p13, and two vectors take endpoint p11 as their vertex. These two vectors have just one turning angle, since line p11p12 is a boundary line e1, then line p11p13 is a boundary line naturally. Line p11p13 is denoted as e2. To provide the basis for the end of the boundary extraction process, this study saves the coordinate of point p12 in advance.  The Cosine function is a monotone function in the interval of 0 to π, so the cosine function is suitable for computing the turning angle of vector pi1pi2 and vector pi1pij. However, the turning angle of vector pi1pi2 and vector pi1pij may be greater than 180 degrees. To obtain the turning angle, this study obtains the cross product of vector pi1pi2 and vector pi1pij firstly.

Definition 5 (Cross Product).
The cross product of vector pi1pi2 and vector pi1pij, denoted as V, is a 3D vector perpendicular to vector pi1pi2 and vector pi1pij.
where Vx, Vz, and Vy are the coordinate values of the cross-product V. Since vector pi1pi2 and vector pi1pij are in the X-Z plane, then the vector V is perpendicular to the X-Z plane. The value of Vy determines the range of the turning angle θj. If Vy ≥ 0, the range of the turning angle θj is 0 to π; If Vy < 0, the range of the turning angle θj is π to 2π. Thus, we have when the turning angle θj gets the maximum value, vector pi1pij is the next edge ei+1 that we should extract. Currently, this study compares the coordinates of point pij and point p12. If pij = p12, then we end the boundary extraction process and collect all the extracted edges to form a complete boundary b, while if the coordinate of point pij is not equal to the point p12, the boundary extraction process should be operated continuously with taking edge ei+1 as the reference extracted edge. Using this solution, the boundary lines of the X-Z projection can be extracted. Finally, this study obtains the complete boundary b by collecting all the extracted edges e1, e2, …, em.
Algorithm 1 summarizes the whole process of the extraction of the boundary for the X-Z projection. Line 2 sets the 3D coordinate system for the cross-floor elements C. Line 3 obtains the X-Z projection image. Lines 4 and 5 collect the projected intersection lines between slabs and cross-floor elements. Lines 6-17 present the detailed steps of boundary extraction for the X-Z projection. Line 18 returns the boundary b. Figure 8 presents an example of the boundary extraction for a projected spiral stair.

The X-Z Topological Path Generation
The boundary of the projected cross-floor elements has been obtained using a novel boundary extraction algorithm. The X-Z topological path generation aims to find the 2D topological network from the boundary of projected cross-floor building elements. The obtained 2D topological network is the projection of the 3D topological network on the X-Z plane.
Since the boundary image of the projected cross-floor elements consists of several sides, selecting a correct start line is the first problem for the generation of the X-Z topological path. Moreover, for each start line, the generated path can take both sides of the start line as directed. To generate the X-Z topological path from the boundary image successfully, this study selects the start line and the path direction of the X-Z topological path firstly. Figure 9 illustrates the selection of the start line and the path direction for the X-Z topological path. The left-side picture is a partial screenshot of the stair flight and the slab. Since the cross-floor indoor path is a topological path that enables people and mobile robots to reach two different floors, the intersection line of the cross-floor element and the slab is the start line of the X-Z topological path undoubtedly. In Figure 9, the left-side picture shows that the intersection line, represented as AB, is the start line of the X-Z topological path. However, both sides of line AB can be the path directions in principle, setting a correct direction for the cross-floor path is another problem that we should address. To select the correct path direction, this study makes a normal line for the start line AB. The normal line has two different directions, and each direction can be the path direction of the X-Z topological path. In the extracted boundary, it is apparent that the conditions are different on both sides of line AB, the boundary lines exist on one side of line AB and not on the other side. The normal line of the start line AB must intersect with the boundary in a direction. This study selects the direction that the normal line intersects with the extracted boundary as the reasonable path direction for the X-Z topological path. In Figure 9, the right-side picture shows the selection of the path direction.
The start line and the path direction are fixed, as shown above, the next section will discuss a novel X-Z topological path generation solution. Figure 10 illustrates the algorithm logic for generating the X-Z topological path. Figure 10a shows an extracted boundary of the projected cross-floor element. The start line of the X-Z topological path is line AB. Figure 10b presents a partially enlarged view of Figure 10a to show the details of path generation, and the endpoints of the generated paths are represented as C0, C1, C2, …, Cn, respectively. A complete X-Z topological path generated by the novel solution is shown in Figure 10c. The detailed procedures of the path generation solution are as follow.
Step 1. Making a vertical line.
Step 1 takes point C0 as the vertex and makes a short vertical line that is perpendicular to line AB. The length of the short vertical line is set to a certain value, denoted as s. This vertical short line has two endpoints, one is C0 and another is C1. Thus, this study obtains a short line C0C1, which is vertical to line AB and values s. Figure 10b shows the details of this operation.
A vertical line C0C1 is obtained in step 1. The vertical line C0C1 can be approximately regarded as a part of the X-Z topological path. The remaining part of the X-Z topological path can then be generated by adopting this solution. Determining the selection method of the reference line must be carried out prior to making the next vertical line, as there is no vertical line without a reference line. On the X-Z plane, there are infinite lines that pass through the endpoint C1. The reference line is one of the infinite lines passing through endpoint C1. Therefore, selecting the reference line among the infinite lines becomes the next problem to overcome. As shown in Figure 10b, this study firstly obtains the line MN by translating the line AB with a distance s along the perpendicular C0C1. The line MN is parallel to line AB and intersects with the extracted boundary, two intersection points are represented as point M and point N, respectively. As shown in Figure 10b, the lengths of the line MC1 and the line C1N are denoted as l11, l12 respectively. To select the reference line, the line MN is rotated in a counter-clockwise direction. When the line MN is rotated with φ degrees, the sum of l11(φ) and l12(φ) is denoted as l(φ), and the absolute value of the difference between l11(φ) and l12(φ) is represented as h(φ). Then, we have      .
In the boundary extraction procedure, some gaps may exist in the extracted boundary. When the line MN rotates through these gaps, there are no intersection points. Then, the value of l11 or l12 may be infinite. However, since we compute the minimum value of l(φ) and h(φ), the infinite value could be removed automatically. Therefore, the influence of these gaps on the selection of reference lines can be automatically resolved.
During the process of generating the 3D topological path, there usually only one suitable path exists on the cross-floor elements. However, for some cross-floor elements with irregular 3D shapes such as the m-style stairs, two topological paths exist on the upper half of the m-style stair. Figure 11 shows the details of the X-Z topological generation for an m-style stair. Figure 11a presents the 3D shape of an m-style stair. Intuitively, the upper half of the m-style stair has two stair flights and the lower half just has one. In addition, the 3D shape of the m-style stair is symmetrical. There will then be two topological paths in the upper half of the m-style stair. Since the start line of the X-Z topological path is the intersection line of the stair flight and the slab. Three start lines exist for the m-style stair. Figure 11b shows the boundary image of the m-style stair. When generating the X-Z topological path in this boundary image, two suitable reference lines exist for the endpoint Ci. Since the upper half of the m-style stair has two stair flights, the corresponding area in the boundary image also has two X-Z topological paths. Thus, this study randomly selects one reference line to conduct the proposed algorithm. Figure 11c shows the generated X-Z topological path for one stair flight of the upper half stair. Similarly, we conduct the proposed algorithm from the start line that has not connected with the generated path, then the other half of the X-Z topological path can be generated. Figure 11d shows the final generated X-Z topological path of the m-style stair. Thus, the proposed X-Z topological path generation algorithm can also process the cross-floor elements that exist in two topological paths in the boundary image. According to step 1 and step 2, the endpoint C1 and the reference line can be selected. The next step to generate the topological path can be conducted with referencing to step 1. To obtain a complete path, step 1 and step 2 are applied in this study in a loop. In each cycle, a part of the topological path can be generated, and finally, all generated topological paths combine into a complete X-Z topological path. Figure 10c shows the complete X-Z topological path of the extracted boundary explicitly.

Path-BIM Intersection
Path-BIM intersection restores the final 3D topological map by intersecting the 2D topological network with the 3D shapes in the BIM data.
Since the generated X-Z topological path in the 2D topological network consists of finite short vertical lines, each short line holds two vertices. These existing vertices in the generated topological path can be adopted to reduce the computation complexity directly in both the path-BIM intersection and the indoor pathfinding. That is, the n + 1 vertices of vertical lines existing in the generated topological path, C0, C1, C2, …, Cn, are retained in the 2D topological network, while others are removed.
For a point Ck = (xk, 0, zk) in the generated topological path, a line lk from (xk, 0, zk) to (xk, yk, zk) is constructed, where yk is a large enough value. For a face fi in 3D shapes of the cross-floor building element, it is usually represented by a triangular, as shown in Figure 8a. The coordinates of the vertices of each triangular are known. Then, an intersected point pki = (xk, yki, zk) of lk and fi can be computed. If lk does not intersect with fi, then pki = (xk, 0, zk). In this manner, we can iterate all the 3D faces in the shapes by obtaining a set of intersection points. Since the passable point is always at the top, the point pkmax = (xk, ykmax, zk) with the largest y value in pki is considered as the final 3D point in the 3D topological map, the details of the path-BIM intersection are illustrated in Figure 12. After the corresponding 3D points of all the topological points are computed, the final 3D topological map can be generated. Rotate line MN with angle φ.

13:
Select the next reference line using Equation (5), Equation (6), and Equation (7). 14: Rerun line 6 to line 13 until line CiCi+1 intersects with the boundary b or the generated path. 15: for any start line in the collection D that does not intersect with the generated path, do.

16:
Rerun line 5 to line 14. 17: Get the X-Z topological path by collecting the generated short vertical line. 18: Get a 3D topological path by intersecting the X-Z topological path with BIM. 19: return 3D topological path P.

Empirical Studies
Since the generation algorithm of the floor-level indoor map has been systematically evaluated in our recent study [2], this section primarily uses different types of cross-floor building elements and integrated buildings to evaluate the proposed solution.

Cross-Floor Indoor Map
This section evaluated the performance of our proposed algorithm on the two most common cross-floor building elements, stairs, and ramps.

(1) Stairs
This study tested the proposed scheme using six types of stairs. As shown in Figure 13, the evaluated stairs contain straight stair, turn stair, L-style stair, n-style stair, m-style stair, and spiral stair. These stairs cover most types of stairs in the BIM model. Therefore, evaluating the proposed solution on these six types of stairs is extremely representative. In the following section, the 3D topological path extraction of these six types of stairs using the proposed scheme is illustrated. Figure 14 shows the X-Z projection images of the evaluated stairs. Figure 14a is the X-Z projection image of the straight stair captured from the design tool. The X-Z projection image of the turn stair is presented in Figure 14b. Unlike the straight stair, the turn stair has a turn with any degree in the middle of the stair. The main difference between the Lstyle stair and the turn stair is that the L-style has a transfer platform. The transfer platform is usually a slab, which is described by an IfcSlab instance. IfcSlab is a component of the construction that provides the lower support (floor) [38]. Additionally, the turn in the L-style stair is usually 90°. In the L-style stair, an IfcStair usually contains two Ifc-StairFlight instances and one IfcSlab instance. The IfcStair refers to a stair assembly entity that aggregates all parts (stair flight, landing, etc., with its own representations) [38]. The two IfcStairFlight instances are connected through the IfcSlab instance. Figure 14c shows the X-Z projection image of the L-style stair. The n-style stair is common in real-world buildings. Because it occupies much less inner space than the L-style stair and the turn stair. Different from an L-style stair, an n-style has a 180° turn through a transfer platform defining by a slab. Like the L-style stair, an n-style stair usually consists of two Ifc-StairFlight instances and one IfcSlab instance. Figure 13d is a typical n-style stair, with an X-Z projection image in Figure 14d. The X-Z projection image of the n-style stair looks like the character 'n'. It is possible to adjust the width of the two IfcStairFlight instances in a design tool. The m-style stairs usually locate in buildings with high traffic, such as school buildings and office buildings, because the m-style stairs provide more walking paths for the crowd. Figure 13e shows the 3D shape of an m-style stair. The X-Z projection image of the m-style stair is presented in Figure 14e. Figure 14f is the X-Z projection image of a spiral stair obtained from the design tool.  Figure 15 illustrates the extracted boundaries of the evaluated stairs. Figure 15a is the extracted boundary of the X-Z projection image of a straight stair. Figure 15b,c shows the extracted boundary of the turn stair and the L-style stair. When the turn in the L-style stair is 90°, the turn stair and the L-style stair have a similar boundary on the X-Z plane. As shown in Figure 15d, the extracted boundary of the projected n-style stair looks like the character 'n'. The extracted boundary of the projected m-style stair is provided in Figure 15e. The innermost short boundary line of the m-style stair may not be extracted, but the proposed X-Z topological path extraction algorithm can avoid the influence of small gaps in the boundary, so the small gaps on the boundary line cannot affect the generation of the X-Z topological path. Figure 15f shows the boundary of the projected spiral stair. The provided scheme can process the cross-floor elements with either regular 3D shapes or irregular 3D shapes. Because this study proposed a novel X-Z topological path generation solution, and the final 3D topological path is generated through a path-BIM intersection procedure. During the X-Z topological path generation, we have defined a length s. The value of the length s has a great influence on the accuracy of the X-Z topological path and 3D topological path, especially for the cross-floor elements with irregular shapes. If the value of s is set enough small, we can generate a high precision X-Z topological path, but it also requires a longer calculation time. The specific length of s should be selected according to the actual situation of users. To demonstrate the effectiveness of our proposed X-Z topological path generation algorithm, this study sets a very small value of 10 cm for the length s. Even if the computing time increases, the generated X-Z topological path and the 3D topological path are very consistent with the actual routes, and the accuracy is very high. The generated X-Z topological paths of the evaluated stairs are presented in Figure 16. The red line in Figure 16a is the X-Z topological path of the straight stair. The X-Z topological path is a straight line, which correctly describes the passable route of the X-Z projection image and the boundary image. Figure 16b shows the X-Z topological path of the evaluated turn stair, which is generated using the novel path generation algorithm. As the L-style stair has a similar 3D shape to the 90° turn stair, the X-Z topological path of the L-style stair, presented in Figure 16c, is similar to the X-Z topological path of the turn stair in Figure 16b. Figure 16d,e shows the generated X-Z topological path of the n-style stair and the m-style stair. Figure 16f is the generated X-Z topological path of the evaluated spiral stair. Thus, the proposed algorithm has an excellent performance in different types of stairs. As shown in Figure 13e, the m-style stair has a special 3D shape. The upper half of the m-style stair has two stair flights, each of which enables individuals to evacuate to the lower floor. The lower half of the m-style stair has one stair flight. An intermediate slab connects the lower half and the upper half. During the X-Z topological path generation process, the lower half of the m-style intersects with the lower floor in the start line. The X-Z topological path generation algorithm was then conducted from this start line. Since the boundary image of the m-style stair is completely symmetric, the proposed path generation algorithm can also be conducted on the part of the intermediate slab. If the 3D shape of the m-style stair is asymmetric, the X-Z topological path generation algorithm can firstly conduct on the lower half of the m-style and one stair flight of the upper half. The X-Z topological path on another stair flight of the upper half stair can be obtained by conducting the path generation algorithm on the corresponding part again. Then, the proposed scheme can generate a reasonable X-Z topological path for the m-style stair. The generation of the X-Z topological path for the m-style stair was done automatically.
As the value of length s has a great influence on the X-Z topological path generation process of the cross-floor elements with irregular shapes. Experiments were also carried out to compare the differences of the generated X-Z topological paths when s takes different values. Figure 17 shows the three X-Z topological paths of a spiral stair generated by setting s = 10 cm, s = 40 cm, and s = 100 cm respectively. As shown in Figure 17b,c, with the value of s increases, the generated X-Z topological path becomes not smooth, and the generated X-Z topological paths slowly become broken lines. When s gets a large enough value, the generated broken line cannot be a reasonable X-Z topological path, the corresponding 3D topological path is also impractical. Thus, for generating a reasonable X-Z topological path and 3D topological path, setting an appropriate value for s is very important.
(a) (b) (c) Figure 17. Three X-Z topological paths of a spiral stair: (a) s = 10 cm, (b) s=40 cm, and (c) s=100 cm. Figure 18 shows the final generated 3D topological path of the evaluated stairs. Figure 18a gives a concrete example of the 3D topological path of the straight stair, which is straight and appears to pass through the center surface of the stair. Figure 18b is the final 3D topological path of the turn stair in a BIM model. Since the X-Z topological path can capture the shape of the extracted boundary, the 3D topological path looks reasonable in the 3D environment. Figure 18c is the final 3D topological path of the L-style stair in a concrete BIM model. Intuitively, the generated 3D topological map can provide a reasonable route in the BIM model. Figure 18d is the 3D topological path of a concrete n-style stair in a building. Our proposed algorithm can provide a reasonable route for the n-style stair. Figure 18e presents a concrete m-style stair in a building and its 3D topological path. Our proposed solution also generates a suitable topological map for the m-style stair. Figure 18f shows the 3D topological map of a concrete spiral stair in a building. Intuitively, the 3D topological map looks more reasonable after the sampling of points in the X-Z topological path during the path-BIM intersection process. (2) Ramps This study evaluated the proposed scheme on two typical types of ramps: the straight ramp and the curved ramp. Figure 19 shows the 3D shape of the evaluated ramps. Figure 19a shows the 3D shape of the straight ramp obtained from the design tool. Figure 19b is the 3D shape of a typically curved ramp. It is possible to adjust the curves of the curved ramp and obtain different types of curved ramps in a design tool.  Figure 20 shows the generation of X-Z projection images for the evaluated straight ramp and the evaluated curved ramp. Figure 20a is the X-Z projection image of the straight ramp obtained from the design tool. The X-Z projection image of the straight ramp is a regular rectangle, which correctly describes the shape of the straight ramp on the X-Z plane. Figure 20b shows the X-Z projection image of the curved ramp. Since the shape of the curved ramp is winding, the X-Z projection is more irregular than the straight ramp.  Figure 21 presents the extraction of the boundaries from the evaluated ramps. Figure 21a is the extracted boundary of the straight ramp, and Figure 21b shows the boundary of the curved ramp obtained by the boundary extraction process. Figure22 presents the X-Z topological path of two evaluated ramps. Figure 22a shows the X-Z topological path of the straight ramp generated from the X-Z topological path generation. The X-Z topological path is a straight line, which correctly describes the passable path of the boundary image. Figure 22b is the X-Z topological path of the curved ramp. The X-Z topological path is not the exacted centerline of the boundary image in the areas near both ends of the curved ramp. However, the sampling of points of the X-Z topological path in the path-BIM intersection process can alleviate this issue and output a more reasonable 3D topological map.  Figure 23 shows the final 3D topological map of the evaluated ramps. By intersecting the X-Z topological path with the 3D shapes, the final 3D topological map is finally obtained. Figure 23a gives a concrete example of the 3D topological map of the straight ramp, which appears as a straight line on the center surface of the straight ramp. Figure 23b is the final 3D topological map of a concrete curved ramp. We also evaluated the accuracy of the 3D topological maps for all six types of stairs and two types of ramps. In the 3D environment, the length of the shortest generated path L1 is the length of its 3D topological map. The actual shortest lengths L2 in the 3D environment are the lengths of middle lines of cross-floor building elements. Table 1 shows the accuracies of the 3D topological map in eight types of cross-floor building elements with s = 10 cm and s = 40 cm. The accuracies of the 3D topological map are all no less than 90%. The smaller the value of s is set, the higher accuracy the building element obtains. Moreover, we observed that both straight stair and straight ramp achieve 100% accuracy. The L-, n-, and m-style stairs are more complex than the straight ones. When s values 10 cm, the accuracies in the 3D topological map are more than 93%. Since the turn stair and Lstyle stair have equivalent 3D shapes, then they have similar accuracies. The spiral stair and the curved ramp are the most complex 3D shapes, and their accuracies are the lowest in all the eight cross-floor building elements. However, their accuracies are still higher than 90%. These findings show that our proposed solution can extract accurate topological maps for cross-floor building elements with any 3D shapes.

Multi-Floor Indoor Map Evaluation
Since the performance of the floor-level indoor map using the proposed scheme has been evaluated in our recent work [2], this study only illustrates three examples of the floor-level indoor map to show its adaptability in different indoor environments. Figure 24a shows the floor-level indoor map of an opening office building. Since many indoor map extraction solutions mainly use the indoor spatial, such as rooms, corridors, the performance of these solutions are unsatisfactory on such BIM models. Although the office building is usually composed of a few regular rooms, there is a lot of furniture and equipment. Figure 24b is the single-level indoor map of a ring hotel. The ring hotel consists of numerous small rooms and irregular aisles, it is a challenge for current indoor map generation schemes to extract the complete indoor map. However, the proposed scheme in this study also provides a complete topological map, which can reach every corner of the ring hotel. Figure 24c shows a floor-level indoor topological map of a shopping mall. Unlike the previous two evaluated models, large shopping malls have both a large number of small rooms and opening spaces, and the spatial layout is complicated. The performance of current indoor map generation algorithms is poor. However, we can use the proposed solution to extract a complete topological indoor map. Subsequently, the proposed solution can be applied to more scenarios than the current indoor map generation schemes.
This study selected three integrated buildings to evaluate the accuracy of the 3D indoor paths generated by the proposed scheme. The teaching building is the place where the school conducts teaching activities. It has two straight stairs and four n-style stairs, a total of six stair flights. The high-rise residential buildings provide shelter for residents. It is a fifteen-floor building with two straight stairs, fifteen n-style stairs, and one m-style stair. The comprehensive office building is for office, and thus contains many offices, meeting rooms, and open space in the building. The office building is a three-floor building with six n-style stairs and four combined stairs. In Figure 25, the left side pictures are the 3D models of these tested buildings, the middle one shows the indoor topological maps generated by our proposed algorithm, and the right pictures are the details of the cross-floor indoor path (green line). Qualitatively, our proposed algorithm generates reasonable 3D indoor maps for all these BIM models. It is worth noting that the path outside the office building is part of the outdoor map generated for the outdoor site, as shown in the middle one in Figure 25c.
This study also tested the accuracy of the indoor topological maps in the three buildings. In the experiments, we arbitrarily determine the starting point and the ending point, and then there is the actual shortest path and the generated shortest path between these two points. The actual shortest path of two points is the path computed using the gridbased map. Thus, the length of the actual path is always shorter than the length of the generated path. Although experiments on numerous pairs of starting points and ending points are conducted, this study selected five representative pairs of data to show the accuracies of the topological maps generated by the proposed solution. The five representative paths are: (1) from the entrance to a hallway, (2) from the entrance to a room, (3) from one room to another on the same floor, (4) from a hallway on the first floor to another on the second floor, and (5) from a hallway on the first floor to a room on the second floor. Table 2 lists the length of the generated shortest path, the length of the actual shortest path, and the accuracy of the experiment results. All the accuracy rates are higher than 81%. The highest accuracy rate is 96.25%, which measures the path from the entrance to a hallway in the hospital building. It is noticing that the accuracy of the path from the entrance to a hallway is the highest of all three buildings. Because the passable grids from the entrance to a hallway are usually more regular than in other scenarios. The cross-floor paths have the worst accuracies in all three buildings. This is partially due to the errors inherited from the cross-floor building elements. Nonetheless, the accuracy rates are all higher than 81%. The average accuracy rates of the three buildings are 89.09%, 89.95%, and 88.01%, respectively. All the average accuracy rates are higher than 88%, this observation conveys that the proposed scheme can obtain accurate topological maps for all these BIM models.

Results and Discussions
The automatic extraction of the 3D indoor map is a fundamental problem in many research fields. Current studies mainly utilized either grid-based maps or topological maps to build floor-level indoor maps, resulting in inefficiency and/or inaccuracy. Furthermore, most studies failed to interpret how to generate a complete 3D indoor map, which consists of both floor-level indoor maps and cross-floor indoor maps. To fill the research gap, an automatic scheme for extracting a 3D indoor map with any shapes is proposed in this study. In this scheme, a hybrid Grid-Topological floor-level indoor map can be extracted by combining a grid-based map and a topological map, and a cross-floor indoor map for irregular 3D shapes can be extracted using a four-step process consisting of X-Z projection, boundary extraction, X-Z topological path generation, and path-BIM intersection respectively.
To validate the effectiveness of the proposed scheme, experiments were carried out on eight typical types of elements of cross-story buildings and three multi-story realworld buildings. The result shows that the proposed scheme is promising in different indoor environments and the average accuracy rates of the evaluated paths are above 88%. Furthermore, the accuracy of the path developed for different cross-road building elements is different, and the more complex the building element, the lower the accuracy (e.g., 100% accuracy for the straight stair and 92.4% accuracy for the spiral stair). The change in accuracy is further confirmed in the multi-story real-world buildings. For the selected five paths from the entrance to a hallway, from the entrance to a room, from one room to another on the same floor, from a hallway on the first floor to another on the second floor, and from a hallway on the first floor to a room on the second floor, the path from the entrance to a hallway has the highest accuracy rate of 96.25%, compared with the accuracy rate of 81.73% for the cross-floor path. Because the passable grids from the entrance to a hallway are usually more regular than in other scenarios.
Although the experiments have shown promising results, this study still has some limitations. On the one hand, this study did not further evaluate the applicability of the generated 3D indoor map for practical applications (e.g., an emergency escape and passenger transfer in transport stations). This is also the limitation of most indoor map studies and future studies are needed to evaluate the generated indoor map. On the other hand, the proposed scheme currently needs manual input of threshold values. Future research is needed to study the effects of threshold values and provide strategies for the automatic determination of the optimal threshold values.

Conclusions
This study proposes a novel solution to generate a complete 3D indoor map using BIM data automatically. The complete 3D indoor map consists of floor-level indoor maps and cross-floor indoor maps. For the floor-level indoor map, the proposed scheme extracts a hybrid Grid-Topological indoor map, which combines the advantages of a grid-based map and a topological map based on BIM data. The generation of Grid-Topological indoor map includes four procedures, and the procedures are information extraction, discretization and mapping, grid-based map thinning, and Grid-Topological map generation, respectively. For the cross-floor indoor map, the proposed scheme generates the cross-floor topological paths through a four-step process, X-Z projection, boundary extraction, X-Z topological path generation, and path-BIM intersection. The X-Z projection maps the 3D shapes of a cross-floor building element into a 2D plane using the top-down view. The boundary extraction obtains the boundary from the X-Z projection image using a novel boundary extraction algorithm. The X-Z topological path generation obtains the topological path of the extracted boundary as a 2D topological path. The path-BIM intersection captures the final topological map by intersecting the 2D topological network with the 3D shapes of the cross-floor elements in BIM. Finally, experiments are conducted on varieties of cross-floor building elements and three real-world multi-floor buildings to evaluate the performance of our proposed scheme.
The result shows that the proposed scheme has good adaptability in different environments and the average accuracy rates of the extracted paths are above 88%. This study will promote the generation of 3D indoor maps and will inspire the application of indoor maps in the area of indoor LBS, indoor robots, and information systems. geographic 3D.