Integration of Constructive Solid Geometry and Boundary Representation (CSG-BRep) for 3D Modeling of Underground Cable Wells from Point Clouds

: The preference of three-dimensional representation of underground cable wells from two-dimensional symbols is a developing trend, and three-dimensional (3D) point cloud data is widely used due to its high precision. In this study, we utilize the characteristics of 3D terrestrial lidar point cloud data to build a CSG-BRep 3D model of underground cable wells, whose spatial topological relationship is fully considered. In order to simplify the modeling process, ﬁrst, point cloud simpliﬁcation is performed; then, the point cloud main axis is extracted by OBB bounding box, and lastly the point cloud orientation correction is realized by quaternion rotation. Furthermore, employing the adaptive method, the top point cloud is extracted, and it is projected for boundary extraction. Thereupon, utilizing the boundary information, we design the 3D cable well model. Finally, the cable well component model is generated by scanning the original point cloud. The experiments demonstrate that, along with the algorithm being fast, the proposed model is e ﬀ ective at displaying the 3D information of the actual cable wells and meets the current production demands. body of the cable well, constitute the underground cable well 3D model. For the wall surface with pipe holes, this study carries out the Boolean operation between the cable well model surface and the cylinder, based on the intersection of the parametric curve and the parametric surface. Under the constraint of topological consistency and using the progressive construction method, the edge is constructed into a wire, the wire is constructed into a face, and the face is constructed into a shell and a solid, in order to build a 3D model of the compound. The underground cable well model developed in this study builds the pipe hole model on the wall surface, which in turn provides a comprehensive description of the topological relationships within the cable well model, because cable well models not only possess a point – line and a line – line relationship, but also the point – surface and line – surface relationship.


Introduction
Underground cable wells, which are an essential component of urban infrastructure and the bedrock of urban functions, constitute the "lifeline" to ensure the smooth operation of cities [1,2]. Therefore, underground cable wells information has evolved into an indispensable component for present-day urban construction and a fundamental resource for urban decision-making [3]. Underground cable wells information management systems that have been established in major cities around the world will ensure effective management and comprehensive utilization of existing underground cable wells. However, due to the wide variety of available underground cable wells, the diverse cable wells are widely distributed and intertwined with complex topological relations within the urban underground space. The two-dimensional management method is inadequate at accurately reflecting the spatial positional relationship between the cable wells. The representation scheme of underground cable wells has been gradually upgraded from traditional two-dimensional symbols to the three-dimensional [4,5]. Therefore, universally establishing a three-dimensional (3D) model of underground cable wells and developing a 3D cable wells information system has evolved relationship information. The BRep model is good for calculating the geometric characteristics of the model [13], and is easy to connect with the surface modeling software, but its largest modeling unit is surface instead of object. It lacks the expression of the basic components of the model and is incapable of taking into consideration the topological relationship between various components. Constructive solid geometry and boundary representation (CSG-BRep) model can record topological relationship of 3D model in detail [25].
Therefore, this study proposes a 3D modeling algorithm for underground cable wells considering spatial topology. The algorithm fully capitalizes on the advantages of point cloud data [26][27][28][29], and generates the model expeditiously through point cloud data preprocessing and boundary extraction. Additionally, this study constructs the cable well component model through real-time scanning of point cloud data, while fully considering the topological relationship between the models and displaying the 3D information of the actual cable wells in order to meet the real-life production needs. The contributions of this paper are as follows: (1) for large-scale discrete point cloud geometric modeling, an adaptive extraction of boundary contour geometric parameters is proposed to construct 3D models of wells and cables. (2) CSG-Brep 3D topological model with spatial topological relation expression between wells and cable is established.

Methods
In view of the lack of spatial topological relationship in the existing 3D point cloud automatic modeling, this paper proposed a modeling method of underground cable wells considering the spatial topological relationship. (1) After the point cloud denoising and simplification, the main axis of the point cloud is determined by calculating the Oriented Bounding Box (OBB) of the well. Combined with quaternion transformation, the 3D model of wells is constructed by adaptively extracting the geometric parameters of the boundary contour. (2) Using the L1 median method and hermit interpolation to obtain the cable passing points, then Sweep method is used to realize the 3D modeling of cable.
(3) According to the spatial relationship between cable and wells, the CSG-BRep topological model is established.

Introduction and Classification of Underground Cable Wells
Underground cable wells are an important part of underground cable wells. Globally, underground cable wells are generally constructed with prefabricated large concrete boxes or on-site poured concrete, as illustrated in Figure 1. Typically, underground power cable wells are divided into four types [30]: straight-through type, three-way type, four-way type and corner type. Based on real-life engineering needs, power cable wells are further divided into different models to meet varied needs. Figure 2 illustrates several representative well types. While different cable wells have disparate design standards, they can all be classified by the type of tensile body. Therefore, by extracting the cable well contour from the point cloud, an overall model can be constructed.
Remote Sens. 2019, 11, x FOR PEER REVIEW 3 of 25 simple to model, but is contains a large amount of data. It is not only difficult to split, but also lacks topological relationship information. The BRep model is good for calculating the geometric characteristics of the model [13], and is easy to connect with the surface modeling software, but its largest modeling unit is surface instead of object. It lacks the expression of the basic components of the model and is incapable of taking into consideration the topological relationship between various components. Constructive solid geometry and boundary representation (CSG-BRep) model can record topological relationship of 3D model in detail [25]. Therefore, this study proposes a 3D modeling algorithm for underground cable wells considering spatial topology. The algorithm fully capitalizes on the advantages of point cloud data [26][27][28][29], and generates the model expeditiously through point cloud data preprocessing and boundary extraction. Additionally, this study constructs the cable well component model through real-time scanning of point cloud data, while fully considering the topological relationship between the models and displaying the 3D information of the actual cable wells in order to meet the real-life production needs. The contributions of this paper are as follows: (1) for large-scale discrete point cloud geometric modeling, an adaptive extraction of boundary contour geometric parameters is proposed to construct 3D models of wells and cables. (2) CSG-Brep 3D topological model with spatial topological relation expression between wells and cable is established.

Methods
In view of the lack of spatial topological relationship in the existing 3D point cloud automatic modeling, this paper proposed a modeling method of underground cable wells considering the spatial topological relationship. (1) After the point cloud denoising and simplification, the main axis of the point cloud is determined by calculating the Oriented Bounding Box (OBB) of the well. Combined with quaternion transformation, the 3D model of wells is constructed by adaptively extracting the geometric parameters of the boundary contour. (2) Using the L1 median method and hermit interpolation to obtain the cable passing points, then Sweep method is used to realize the 3D modeling of cable. (3) According to the spatial relationship between cable and wells, the CSG-BRep topological model is established.

Introduction and Classification of Underground Cable Wells
Underground cable wells are an important part of underground cable wells. Globally, underground cable wells are generally constructed with prefabricated large concrete boxes or on-site poured concrete, as illustrated in Figure 1. Typically, underground power cable wells are divided into four types [30]: straight-through type, three-way type, four-way type and corner type. Based on real-life engineering needs, power cable wells are further divided into different models to meet varied needs. Figure 2 illustrates several representative well types. While different cable wells have disparate design standards, they can all be classified by the type of tensile body. Therefore, by extracting the cable well contour from the point cloud, an overall model can be constructed.

Modeling Method of Underground Cable Wells
The 3D modeling of underground cable wells is divided into cable well model construction and well chamber component model construction. The construction process of the cable well model includes preprocessing the point cloud data, determining the main axis, extracting the planar point cloud, extracting the boundary, and constructing triangular patches. Based on the spatial characteristics of the underground cable wells and the element characteristics of the cable wells body, the abovementioned method establishes a true 3D model of the cable well. Considering the quality of the 3D laser scan data, firstly, it is necessary to implement adaptive de-noising on large-scale point cloud data and administer simplifications, while retaining the morphological features of the point cloud model. The characteristics of various 3D entity objects enable the quick extraction of boundary contour information and geometric parameter information from the point cloud data, to construct a 3D model of the cable well. Well chamber component modeling includes pipe hole modeling and cable wells modeling. In the pipe hole modeling process, first, the circular hole center of the surface point cloud is extracted, and then the topological intersection between the cylinder and the surface is performed to obtain the pipe hole model. In the cable wells modeling process, firstly Hermit interpolation is directly used to obtain the cable wells path points for cable wells that are difficult to be segmented, while L1 median value is used to obtain the path points for the point cloud that can be segmented. And then, the cable wells radius is identified to generate the cross-section circle at the starting point of the cable wells. Finally, the Sweep method of the interpolation points and the crosssection circle generates the smooth cable wells. The specific process is illustrated in Figure 3:

Modeling Method of Underground Cable Wells
The 3D modeling of underground cable wells is divided into cable well model construction and well chamber component model construction. The construction process of the cable well model includes preprocessing the point cloud data, determining the main axis, extracting the planar point cloud, extracting the boundary, and constructing triangular patches. Based on the spatial characteristics of the underground cable wells and the element characteristics of the cable wells body, the abovementioned method establishes a true 3D model of the cable well. Considering the quality of the 3D laser scan data, firstly, it is necessary to implement adaptive de-noising on large-scale point cloud data and administer simplifications, while retaining the morphological features of the point cloud model. The characteristics of various 3D entity objects enable the quick extraction of boundary contour information and geometric parameter information from the point cloud data, to construct a 3D model of the cable well. Well chamber component modeling includes pipe hole modeling and cable wells modeling. In the pipe hole modeling process, first, the circular hole center of the surface point cloud is extracted, and then the topological intersection between the cylinder and the surface is performed to obtain the pipe hole model. In the cable wells modeling process, firstly Hermit interpolation is directly used to obtain the cable wells path points for cable wells that are difficult to be segmented, while L1 median value is used to obtain the path points for the point cloud that can be segmented. And then, the cable wells radius is identified to generate the cross-section circle at the starting point of the cable wells. Finally, the Sweep method of the interpolation points and the cross-section circle generates the smooth cable wells. The specific process is illustrated in Figure 3:

Simplification of the Point Cloud
As the point cloud data obtained by scanning contains considerable redundancy, using the original point cloud for modeling will consume a significant amount of time and resources. Therefore, the point cloud data must be simplified and filtered before it is utilized in modeling. The original methods of point cloud data simplification and filter are primarily based on the principles of distance, curvature and normal direction, etc. However, current point cloud simplification methods principally focus on the following methods: bounding box method, geometric image simplification method, curvature simplification method, and normal precision simplification method. The bounding box method refers to grouping the point cloud into the small cubes divided by the smallest bounding box, and only the points close to the center of each small cube are retained [31]. For the geometric image simplification method, point cloud is converted into raster image, and point cloud reduction is realized by the graphic processing method [32]. For the curvature simplification method, it obtains reference data of local profile of point cloud by establishing a spatial index. The free-form surface is used to approximate to the data and estimate the curvature of the data, and the point cloud data is simplified according to the curvature distribution [33][34][35][36]. Normal precision simplification method is an improvement method of curvature simplification method, which refers to the point product of two normal vectors of adjacent local surfaces to replace the curvature of local surfaces [37].
In view of the aforementioned analysis and summary of the existing algorithms, this study adopts a point cloud simplification filtering algorithm using movable mesh generation. The algorithm primarily simplifies the point cloud through a spatial mesh, which has an obvious advantage of speed in processing, and is able to achieve the required effect. Additionally, the

Simplification of the Point Cloud
As the point cloud data obtained by scanning contains considerable redundancy, using the original point cloud for modeling will consume a significant amount of time and resources. Therefore, the point cloud data must be simplified and filtered before it is utilized in modeling. The original methods of point cloud data simplification and filter are primarily based on the principles of distance, curvature and normal direction, etc. However, current point cloud simplification methods principally focus on the following methods: bounding box method, geometric image simplification method, curvature simplification method, and normal precision simplification method. The bounding box method refers to grouping the point cloud into the small cubes divided by the smallest bounding box, and only the points close to the center of each small cube are retained [31]. For the geometric image simplification method, point cloud is converted into raster image, and point cloud reduction is realized by the graphic processing method [32]. For the curvature simplification method, it obtains reference data of local profile of point cloud by establishing a spatial index. The free-form surface is used to approximate to the data and estimate the curvature of the data, and the point cloud data is simplified according to the curvature distribution [33][34][35][36]. Normal precision simplification method is an improvement method of curvature simplification method, which refers to the point product of two normal vectors of adjacent local surfaces to replace the curvature of local surfaces [37].
In view of the aforementioned analysis and summary of the existing algorithms, this study adopts a point cloud simplification filtering algorithm using movable mesh generation. The algorithm primarily simplifies the point cloud through a spatial mesh, which has an obvious advantage of speed in processing, and is able to achieve the required effect. Additionally, the simplification criterion of twice moving mesh divisions is capable of incorporating the criterions of the abovementioned algorithms.

Determination of the Main Axis by Calculating the OBB Bounding Box
Three directions can be obtained by using the OBB bounding box [38]. Based on the length of the side, the initial main axis direction of the geometric solid can be selected. This study uses the OBB bounding box method to obtain axial directions and takes the direction of the longest side as the initial main axis direction. The method is also referred to as principal component analysis (PCA). The reference [39] enhances the above method by assigning different Gaussian weights to each point. Thus, the influence of various distance points on the normal are varied, and the points closer to the point have greater influence, generating a more realistic estimation result. In this study, the direction with the wellbore is defined as the main axis direction of the cable well. In case the initial direction is inconsistent with the main axis direction, either due to a subsequent wellbore boundary or in instances when the model is consistent with the actual point cloud, the direction correction is conducted to determine the final main axis direction.

Rotation by Quaternion
According to the obtained axial direction, it may be set to n = (a, b, c), unitize n, and calculate the angle between n and the coordinate axis z by Formula (1).
where n 1 = (0, 0, 1), and the symbol · represents the dot product of two vectors. Based on the quaternion rotation method, only one rotation axis and one rotation angle are needed to complete the arbitrary rotation in space (around any axis, rotating at any angle). Among them, the rotation angle is θ, obtained from Formula (1), and the rotation axis can be solved by Formula (2).
where n and n 1 are the same as Formula (1), and the symbol × represents the cross product of two vectors. The result is a vector and will unitize dir as well. The rotation process is completed according to the quaternion rotation Formula (3) [40].
where P represents any point in the original point cloud to be rotated, and P 1 represents the corresponding point after rotation according to the quaternion This formula can complete the conversion process from P to P 1 , so that the original point cloud stands in the Z-axis direction. Using the quaternion rotation method above, the rotation axis of the rotating body is rotated to the Z-axis direction, and the corresponding rotation matrix is calculated. Then, the point cloud data is multiplied by the rotation matrix, respectively, so the rotating body stands upright in 3D space along the rotation axis direction.

Extraction of the Cable Well Top Point Cloud
In this study, the top point cloud extraction is performed by the adaptive method. The highest point, z max , and the lowest point, z min , are obtained by calculating the maximum and minimum values on the Z-axis of the rotated point cloud. Define the layering distance to 0.1 m, the point cloud was Remote Sens. 2020, 12, 1452 7 of 23 consecutively extracted from top to bottom, and the normal direction of the extracted plane was calculated in real-time until it is parallel to the main axis (it can be considered parallel if the angle between them is less than a certain degree). As shown in Figure 4.
Remote Sens. 2019, 11, x FOR PEER REVIEW 7 of 25 calculated in real-time until it is parallel to the main axis (it can be considered parallel if the angle between them is less than a certain degree). As shown in Figure 4. As the top and bottom faces of the cable well are inclined, or not completely flat Figure 5a, during the actual production process, it results in an incomplete separation of the scanned point cloud Figure  5b. In order to satisfy the set threshold, the separated point cloud is shown in Figure 5c. In this study, the top point cloud is extracted by plane fitting multiple times. This study performs plane fitting by RANSAC algorithm [41][42][43][44]. When parameters are extracted, the barycentric coordinates of the point cloud are used to realize the plane fitting optimization. As the separated top point cloud may have a missing part, to accomplish plane fitting, the point cloud within a certain distance threshold from the plane is extracted from the overall point cloud based on the fitting parameters. With the gradually reduced threshold, multiple iterations are performed to obtain the top point cloud data without any missing parts, and the point cloud is projected onto the fitting plane.

Extraction of the Boundary by Constructing the Triangulation Network
Before extracting the boundary, it is necessary to establish the topological relationship between triangles, edges, and vertices. Then, the recursive method is conducted to extract the boundary. Using a loop process, first, identify an edge with only one adjacent triangle in the edge set, and the two endpoints of it are used as the previous and current point of the polygon boundary, respectively. Then, in the adjacent triangles of the current point, find the edge with just one adjacent triangle and with the two endpoints that have one and only one point that coincides with the current point or the previous point. The non-coincident endpoint of the edge serves as the next point of the polygon  As the top and bottom faces of the cable well are inclined, or not completely flat Figure 5a, during the actual production process, it results in an incomplete separation of the scanned point cloud Figure 5b. In order to satisfy the set threshold, the separated point cloud is shown in Figure 5c. In this study, the top point cloud is extracted by plane fitting multiple times.
Remote Sens. 2019, 11, x FOR PEER REVIEW 7 of 25 calculated in real-time until it is parallel to the main axis (it can be considered parallel if the angle between them is less than a certain degree). As shown in Figure 4. As the top and bottom faces of the cable well are inclined, or not completely flat Figure 5a, during the actual production process, it results in an incomplete separation of the scanned point cloud Figure  5b. In order to satisfy the set threshold, the separated point cloud is shown in Figure 5c. In this study, the top point cloud is extracted by plane fitting multiple times. This study performs plane fitting by RANSAC algorithm [41][42][43][44]. When parameters are extracted, the barycentric coordinates of the point cloud are used to realize the plane fitting optimization. As the separated top point cloud may have a missing part, to accomplish plane fitting, the point cloud within a certain distance threshold from the plane is extracted from the overall point cloud based on the fitting parameters. With the gradually reduced threshold, multiple iterations are performed to obtain the top point cloud data without any missing parts, and the point cloud is projected onto the fitting plane.

Extraction of the Boundary by Constructing the Triangulation Network
Before extracting the boundary, it is necessary to establish the topological relationship between triangles, edges, and vertices. Then, the recursive method is conducted to extract the boundary. Using a loop process, first, identify an edge with only one adjacent triangle in the edge set, and the two endpoints of it are used as the previous and current point of the polygon boundary, respectively. Then, in the adjacent triangles of the current point, find the edge with just one adjacent triangle and with the two endpoints that have one and only one point that coincides with the current point or the previous point. The non-coincident endpoint of the edge serves as the next point of the polygon This study performs plane fitting by RANSAC algorithm [41][42][43][44]. When parameters are extracted, the barycentric coordinates of the point cloud are used to realize the plane fitting optimization. As the separated top point cloud may have a missing part, to accomplish plane fitting, the point cloud within a certain distance threshold from the plane is extracted from the overall point cloud based on the fitting parameters. With the gradually reduced threshold, multiple iterations are performed to obtain the top point cloud data without any missing parts, and the point cloud is projected onto the fitting plane.

Extraction of the Boundary by Constructing the Triangulation Network
Before extracting the boundary, it is necessary to establish the topological relationship between triangles, edges, and vertices. Then, the recursive method is conducted to extract the boundary. Using a loop process, first, identify an edge with only one adjacent triangle in the edge set, and the two endpoints of it are used as the previous and current point of the polygon boundary, respectively. Then, in the adjacent triangles of the current point, find the edge with just one adjacent triangle Remote Sens. 2020, 12, 1452 8 of 23 and with the two endpoints that have one and only one point that coincides with the current point or the previous point. The non-coincident endpoint of the edge serves as the next point of the polygon boundary, and consecutive points of the boundary are successively identified by the recursive method. The boundary extraction is complete when the next point coincides with the first point of the boundary [45]. Consequently, enter the next loop to extract the next boundary until all boundaries have been extracted.
After extracting the boundary, this study uses the RANSAC algorithm for spatial circle fitting [46] and extracts the wellhead parameters by setting the radius threshold. For peripheral boundary points, this study adopts the straight-line fitting method to extract key points. As the extracted boundary in this study is ordered, taking the starting point as the benchmark, in order to determine key points, the straight-line parameters are obtained by performing straight-line fitting on adjacent points respectively. Then, two key points are respectively fitted to determine if a curve or a straight line is formed. Finally, the curve points are extracted while the straight-line points are deleted, in order to establish the subsequent triangular patches.

Refining the Cable Well Model by Constructing Triangular Patches
Using the abovementioned method, the bottom face of the point cloud data is extracted, and the plane fitting is performed on it. The parameters are used to calculate the distances between the two planes. Based on the top face boundary line, the projection of the top face boundary points to the bottom face is identified. Triangular patches are constructed, depending upon the boundary information and the height of the model, to conduct refined modeling to fit the point cloud data. To identify boundary points of the top wellhead, this study uses the spatial circle fitting method based on RANSAC to extract the center and radius of the well borehole. Consequently, along with the overall boundary points, the triangular patches are generated to complete the construction of the cable well model.

Construction of the Cable Well Pipe Hole Model
The pipe hole of the cable well is the foundation of the cable connection. In this study, the plane separation of the point cloud and the model is carried out based on the original point cloud data and the generated model parameters. The boundary line to fit the pipe hole center is extracted for the separated point cloud plane, after its rotation and projection.
As the separated plane by the actual point cloud is an arbitrary plane in space, it is rotated to the xoy plane by the Rodrigues' rotation matrix. Let the initial normal of the space plane be n = (n x , n y , n z ), and after rotation the normal is n = (0, 0, 1), so the rotation angle θ is Then, the rotation axis ω(ω x , ω y , ω z ) is The rotation matrix is After the point cloud rotation, the projection of the point cloud to the xoy plane is conducted, and then the boundary line extraction is carried out. The RANSAC method is also applied to perform Remote Sens. 2020, 12, 1452 9 of 23 the spatial circle fitting of all extracted boundary lines. By setting the circle radius threshold, the pipe hole center is extracted. The flow is shown in Figure 6. Distinct errors remain between the actual obtained center point and the actual model surface. The ray projection method is used to obtain the projection point of the center of the circle on the wall triangulation network. Taking the projection point as the reference, the 3D model cutting algorithm is used to perform topological shearing on the wall triangulation network of the cable well to complete the secondary cutting of the model. Currently, there are certain inconsistencies in the existing 3D model cutting methods. In instances of complex target entities, such as curved surface walls which are cut to obtain doors, windows or pipe holes, cutting errors occur. The algorithm is modified to achieve a stable topological shearing suitable for architectural expression by the application of a combination of OpenCASCADE and Cork in model cutting. Try to merge the top triangulation network cutting method [47] to solve the cutting problems of the complex triangulation network of the unclosed surface, the non-manifold edge and the self-intersecting. Finally, the pipe hole model is generated.

Construction of the Cable
While the cable is an essential component of the underground cable well, a direct cable connection between pipe holes is not aesthetically pleasing and inevitably results in the intersection of the cable models. Therefore, in this study, in order to optimize the cable model, the cubic Hermite interpolation [48] of two nodes is used to achieve the interpolation of cable path points. Before the cable model is constructed, the starting and ending point of the cable are chosen by 3D interaction. As the starting and ending position of the cable are located on the planes of the cable model, the normals, = ( , , ) and = ( , , ), of the planes, where the cable starting point = ( , , ) and the cable ending point = ( , , ) are located, can be obtained. Let = × , where the symbol  represents the cross product of two vectors. The resultant , which is the normal of the plane where the curve lies, is a vector and can be unitized as well. The Gaussian plane rectangular coordinate system 0 0 0 is constructed based on the plane, whose coordinate origin is the midpoint of the , connection.
Let dis represent the distance between a p and b p . After the conversion, the coordinates of and are ′ = (− /2,0,0) and ′ = ( /2,0,0) . Set the rotation matrix to R and the translation vector to ( , , ) Distinct errors remain between the actual obtained center point and the actual model surface. The ray projection method is used to obtain the projection point of the center of the circle on the wall triangulation network. Taking the projection point as the reference, the 3D model cutting algorithm is used to perform topological shearing on the wall triangulation network of the cable well to complete the secondary cutting of the model. Currently, there are certain inconsistencies in the existing 3D model cutting methods. In instances of complex target entities, such as curved surface walls which are cut to obtain doors, windows or pipe holes, cutting errors occur. The algorithm is modified to achieve a stable topological shearing suitable for architectural expression by the application of a combination of OpenCASCADE and Cork in model cutting. Try to merge the top triangulation network cutting method [47] to solve the cutting problems of the complex triangulation network of the unclosed surface, the non-manifold edge and the self-intersecting. Finally, the pipe hole model is generated.

Construction of the Cable
While the cable is an essential component of the underground cable well, a direct cable connection between pipe holes is not aesthetically pleasing and inevitably results in the intersection of the cable models. Therefore, in this study, in order to optimize the cable model, the cubic Hermite interpolation [48] of two nodes is used to achieve the interpolation of cable path points. Before the cable model is constructed, the starting and ending point of the cable are chosen by 3D interaction. As the starting and ending position of the cable are located on the planes of the cable model, the normals, n a = (n x , n y , n z ) and n b = (n x , n y , n z ), of the planes, where the cable starting point p a = (x a , y a , z a ) and the cable ending point p b = (x b , y b , z b ) are located, can be obtained. Let dir = n a × n b , where the symbol × represents the cross product of two vectors. The resultant dir, which is the normal of the plane where the curve lies, is a vector and can be unitized as well. The Gaussian plane rectangular coordinate system x 0 0 y 0 is constructed based on the plane, whose coordinate origin is the midpoint of the p a , p b connection.
Let dis represent the distance between p a and p b . After the conversion, the coordinates of p a and p b are p a = (−dis/2, 0, 0) and p b = (dis/2, 0, 0). Set the rotation matrix to R and the translation vector to t(t x , t y , t z ), then p a = R · p a + t (9) p c = (0, 0, 1) The rotation matrix R can be solved inversely according to the relationship between the three corresponding points [49].
Let the center of the point set p be C and the center of the point set p be C . Get barycentric coordinates of the point cloud by and calculate the matrix H by Finally, perform the singular value decomposition (SVD) on the matrix H, that is, where the 3×3 rotation matrix R is R = VU T (17) and the translation vector t(t x , t y , t z ) is Let dir x = (1, 0, 0), dir y = (0, 1, 0), n a = (n x , n y , n z ) and n b = (n x , n y , n z ). Then the slope of point a in the Gaussian plane rectangular coordinate system is k a = R · n a · dir y R · n a · dir x (19) and for point b, the slope is The interpolation function is not only required to have the same value as the function at the node, but also required to have the same first-order, second-order and even higher-order derivative values as the function at the node, which is the Hermite interpolation problem. In this study, the Hermite interpolation with equal function values and first-order derivative values to the interpolation function at the node is used, in order to optimize the cable curve by achieving the interpolation of the curved cable path points. The interpolation process is shown in Figure 7.
In the instances of the cable well with spare parts, the L1 median skeleton line extraction method is used to extract the cable well central axis and the cable well point cloud is segmented by preprocessing. The local L1 median can be expressed by the below optimized formula [50]: arg m min x i∈I j∈J where Q = q j j∈J ∈ R 3 is the input point cloud data, X = {x i } i∈I ∈ R 3 is the point set randomly sampled from Q, and the points number I<<J. R(X) is a regular term. In order to avoid the local gathering center phenomenon caused by the use of local L1 median, the constraint is added to deter the shrinking sample points from gathering in the center. In the instances of the cable well with spare parts, the L1 median skeleton line extraction method is used to extract the cable well central axis and the cable well point cloud is segmented by preprocessing. The local L1 median can be expressed by the below optimized formula [50]: where = { } ∈ ∈ 3 is the input point cloud data, = { } ∈ ∈ 3 is the point set randomly sampled from , and the points number I<<J. ( ) is a regular term. In order to avoid the local gathering center phenomenon caused by the use of local L1 median, the constraint is added to deter the shrinking sample points from gathering in the center. The steps of the algorithm are as follows: randomly sample a group of sample points from the original point cloud data as the initial center points; compare the distance of the point in the point cloud to each center point, and divide all the points into the nearest category to form the initial classification; the local median is calculated by L1, and the established local median point is taken as the new central point; after iterative reclassification, each point is allocated to the neighborhood of the nearest central point, and as a consequence of the steadily expanding neighborhood, some details are repeated.
Set the cable radius and generate the cable cross-section circle at the cable starting point. The smooth cable is generated through the Sweep method [51] of the interpolation points and the crosssection circle. The Sweep method has been widely applied in the design and generation of graphics as a method of generating 3D graphics by combining simple two-dimensional graphics, especially for cable modeling, as it is more convenient and flexible than other methods. The method is a powerful means of constructing 3D shapes. The principle of geometric modeling with the method is as follows: first, determine the trajectory line and the cross-section of a graphic, and then move the cross-section along the determined trajectory line to form a geometric model. As only one trajectory line and one cross-section are needed, the method is very simple and efficient. As demonstrated [52], the surface generated by sweeping along a path can usually be expressed as where ( ) represents the trajectory line, 1( , ) or 2( , ) represent the plane cross-section, and N or B represent the unit vector in the moving frame moving along the trajectory line. As illustrated in Figure 8, the moving frame can be used for positioning and posture adjustment of the moving object.
The plane where the curve lies The plane where the curve lies The steps of the algorithm are as follows: randomly sample a group of sample points from the original point cloud data as the initial center points; compare the distance of the point in the point cloud to each center point, and divide all the points into the nearest category to form the initial classification; the local median is calculated by L1, and the established local median point is taken as the new central point; after iterative reclassification, each point is allocated to the neighborhood of the nearest central point, and as a consequence of the steadily expanding neighborhood, some details are repeated.
Set the cable radius and generate the cable cross-section circle at the cable starting point. The smooth cable is generated through the Sweep method [51] of the interpolation points and the cross-section circle. The Sweep method has been widely applied in the design and generation of graphics as a method of generating 3D graphics by combining simple two-dimensional graphics, especially for cable modeling, as it is more convenient and flexible than other methods. The method is a powerful means of constructing 3D shapes. The principle of geometric modeling with the method is as follows: first, determine the trajectory line and the cross-section of a graphic, and then move the cross-section along the determined trajectory line to form a geometric model. As only one trajectory line and one cross-section are needed, the method is very simple and efficient. As demonstrated [52], the surface generated by sweeping along a path can usually be expressed as where C (v) represents the trajectory line, c 1(u,v) or c 2(u,v) represent the plane cross-section, and N or B represent the unit vector in the moving frame moving along the trajectory line. As illustrated in Figure 8, the moving frame can be used for positioning and posture adjustment of the moving object. The method of sweeping along the path is used to indicate the tubular object. During the sweep, the cross-sectional shape is fixed and only its size and scale are changed until the entire trajectory line is traversed. Throughout the process, the trajectory line and cross-sectional shape can be specified by parameters, and the splicing of the surface can be reduced to better indicate the tubular surface. The generated cables are illustrated in Figure 9.

The Construction of the Topological Relationship in Cable Wells
The model is composed of basic elements, which are grouped into vertices, edges, wires, faces, shells, solids, complex solids and compounds, presenting a recursive relationship from simple to complex. As shown in Figure 10 The method of sweeping along the path is used to indicate the tubular object. During the sweep, the cross-sectional shape is fixed and only its size and scale are changed until the entire trajectory line is traversed. Throughout the process, the trajectory line and cross-sectional shape can be specified by parameters, and the splicing of the surface can be reduced to better indicate the tubular surface. The generated cables are illustrated in Figure 9.

The Construction of the Topological Relationship in Cable Wells
The model is composed of basic elements, which are grouped into vertices, edges, wires, faces, shells, solids, complex solids and compounds, presenting a recursive relationship from simple to complex. As shown in Figure 10. The method of sweeping along the path is used to indicate the tubular object. During the sweep, the cross-sectional shape is fixed and only its size and scale are changed until the entire trajectory line is traversed. Throughout the process, the trajectory line and cross-sectional shape can be specified by parameters, and the splicing of the surface can be reduced to better indicate the tubular surface. The generated cables are illustrated in Figure 9.

The Construction of the Topological Relationship in Cable Wells
The model is composed of basic elements, which are grouped into vertices, edges, wires, faces, shells, solids, complex solids and compounds, presenting a recursive relationship from simple to complex. As shown in Figure 10. Through the construction of the topology model, the underground cable well model constructed by the algorithm can be decomposed by each unit, and thereby the componentization of the cable well model is achieved. In underground cable wells, there is a physical and logical relationship between the walls and the attached pipe holes of each cable well through cable well connections. In order to visualize the data organization, and to perform spatial query and spatial analysis of the 3D underground cable wells network, it is necessary to establish a 3D model that can effectively describe the network system, and provide a complete formal representation of the spatial relationship. Through the spatial elements mentioned above, this study accomplishes the construction of a comprehensive topology model (CSG-BRep model [53]). Under the constraint of topological consistency, the complex 3D geometric model is constructed progressively by basic geometric voxels. In this process, the lower-level topological objects are constructed step by step into higher-level topological objects and the construction across levels cannot happen. The model synthesizes the macroscopic combination of CSG model [54] and the microcosmic expression of BRep model [55]. By geometric abstraction, the complex objects are decomposed into CSG basic voxels, and the parameters of the corresponding axis or edge are extracted to develop the parameter equation, which is conducive to further calculation. In addition, the model can comprehensively and meticulously record the topological relationship inside the cable well. Through the construction of the topology model, the underground cable well model constructed by the algorithm can be decomposed by each unit, and thereby the componentization of the cable well model is achieved. In underground cable wells, there is a physical and logical relationship between the walls and the attached pipe holes of each cable well through cable well connections. In order to visualize the data organization, and to perform spatial query and spatial analysis of the 3D underground cable wells network, it is necessary to establish a 3D model that can effectively describe the network system, and provide a complete formal representation of the spatial relationship. Through the spatial elements mentioned above, this study accomplishes the construction of a comprehensive topology model (CSG-BRep model [53]). Under the constraint of topological consistency, the complex 3D geometric model is constructed progressively by basic geometric voxels. In this process, the lower-level topological objects are constructed step by step into higher-level topological objects and the construction across levels cannot happen. The model synthesizes the macroscopic combination of CSG model [54] and the microcosmic expression of BRep model [55]. By geometric abstraction, the complex objects are decomposed into CSG basic voxels, and the parameters of the corresponding axis or edge are extracted to develop the parameter equation, which is conducive to further calculation. In addition, the model can comprehensively and meticulously record the topological relationship inside the cable well.
As shown in Figure 11, the overall design of the underground cable well model is based on the building wall surface, that contains pipe holes, channel holes and other structures. The cable well body composed of multiple surfaces, such as the pipe hole model attached to the wall surface and responsible for the cable connection in the well, and body elements such as the cable wellbore superimposed on the main body of the cable well, constitute the underground cable well 3D model. For the wall surface with pipe holes, this study carries out the Boolean operation between the cable well model surface and the cylinder, based on the intersection of the parametric curve and the parametric surface. Under the constraint of topological consistency and using the progressive construction method, the edge is constructed into a wire, the wire is constructed into a face, and the face is constructed into a shell and a solid, in order to build a 3D model of the compound. The underground cable well model developed in this study builds the pipe hole model on the wall surface, which in turn provides a comprehensive description of the topological relationships within the cable well model, because cable well models not only possess a point-line and a line-line relationship, but also the point-surface and line-surface relationship. As shown in Figure 11, the overall design of the underground cable well model is based on the building wall surface, that contains pipe holes, channel holes and other structures. The cable well body composed of multiple surfaces, such as the pipe hole model attached to the wall surface and responsible for the cable connection in the well, and body elements such as the cable wellbore superimposed on the main body of the cable well, constitute the underground cable well 3D model. For the wall surface with pipe holes, this study carries out the Boolean operation between the cable well model surface and the cylinder, based on the intersection of the parametric curve and the parametric surface. Under the constraint of topological consistency and using the progressive construction method, the edge is constructed into a wire, the wire is constructed into a face, and the face is constructed into a shell and a solid, in order to build a 3D model of the compound. The underground cable well model developed in this study builds the pipe hole model on the wall surface, which in turn provides a comprehensive description of the topological relationships within the cable well model, because cable well models not only possess a point-line and a line-line relationship, but also the point-surface and line-surface relationship.  Figure 11. Topological structure of the underground cable well model.

Instrument and Data
The experimental instrument used in this study is the Faro S150 3D laser scanner. The scanning distance is set to indoor 10 m, the resolution is 28.9 MPTs, the distance error is ±2mm, the measuring horizontal angle is 0°-360°, and the measuring vertical angle is −65° to 90°. As illustrated in Figure  12, during the experiment, the scanner is lowered into the cable well by tripod to avert accidental

Instrument and Data
The experimental instrument used in this study is the Faro S150 3D laser scanner. The scanning distance is set to indoor 10 m, the resolution is 28.9 MPTs, the distance error is ±2mm, the measuring horizontal angle is 0 • -360 • , and the measuring vertical angle is −65 • to 90 • . As illustrated in Figure 12, during the experiment, the scanner is lowered into the cable well by tripod to avert accidental injuries to the staff, thereby fully capitalizing on the non-contact measurement features of laser scanning. The original data scanned by the experiment is in FLS data format, and it can be converted to PTX or PTS format by Faro's own software SCENE. Firstly, as a result of the comparison of several simplification algorithms, it is concluded that the simplification algorithm of twice moving mesh divisions is efficient and effective. Therefore, in contrast to the density-based adaptive simplification and the percentage simplification, this study uses the simplification of twice moving mesh divisions. The simplification effects of the various methods are illustrated in Figure 13. The simplification comparison of various methods is detailed in Table 1. From this table above, it can be concluded that the simplification of twice moving mesh divisions is quicker and generates superior simplified effect.  Firstly, as a result of the comparison of several simplification algorithms, it is concluded that the simplification algorithm of twice moving mesh divisions is efficient and effective. Therefore, in contrast to the density-based adaptive simplification and the percentage simplification, this study uses the simplification of twice moving mesh divisions. The simplification effects of the various methods are illustrated in Figure 13. The simplification comparison of various methods is detailed in Table 1. From this table above, it can be concluded that the simplification of twice moving mesh divisions is quicker and generates superior simplified effect. contrast to the density-based adaptive simplification and the percentage simplification, this study uses the simplification of twice moving mesh divisions. The simplification effects of the various methods are illustrated in Figure 13. The simplification comparison of various methods is detailed in Table 1. From this table above, it can be concluded that the simplification of twice moving mesh divisions is quicker and generates superior simplified effect.

The Modeling Experiment of Underground Cable Wells and the Corresponding Results
In order to verify the effect of the generated underground cable wells model, this study uses a variety of underground cable wells data types for cable well model construction and internal cable well model construction. Four main geometric forms of point cloud are selected as the experimental data. Point Cloud 1 is the Turning type, Point Cloud 2 is the Three-way type, Point Cloud 3 represents the Straight-through type and Point Cloud 4 represents the Four-way type. As illustrated in Figure 14, the applicability of the proposed algorithm is verified by modeling multiple data types.

The Modeling Experiment of Underground Cable Wells and The Corresponding Results
In order to verify the effect of the generated underground cable wells model, this study uses a variety of underground cable wells data types for cable well model construction and internal cable well model construction. Four main geometric forms of point cloud are selected as the experimental data. Point Cloud 1 is the Turning type, Point Cloud 2 is the Three-way type, Point Cloud 3 represents the Straight-through type and Point Cloud 4 represents the Four-way type. As illustrated in Figure  14, the applicability of the proposed algorithm is verified by modeling multiple data types.  Figure 15 illustrates the overall point cloud of the underground cable well in the original scene and the image generated by the single-site point cloud. Figure 15a shows the actual situation of the connection between underground wells, Figure 15b shows the distribution of cables inside the wells, Figure 15c reflects the overall situation of the wells after modeling, and Figure 15d shows the overall effect of well modeling and internal cable modeling.
Remote Sens. 2019, 11, x FOR PEER REVIEW 17 of 25 Figure 15 illustrates the overall point cloud of the underground cable well in the original scene and the image generated by the single-site point cloud. Figure 15a shows the actual situation of the connection between underground wells, Figure 15b shows the distribution of cables inside the wells, Figure 15c reflects the overall situation of the wells after modeling, and Figure 15d shows the overall effect of well modeling and internal cable modeling.

Results and Discussion
In order to validate the exceptional accuracy and practicability of the proposed algorithm at modeling the underground cable well point cloud data with holes, we utilize three different types of cable well wall data: the curved surface point cloud data Figure 16a, the rectangular planar point cloud data Figure 16b and the irregular planar point cloud data Figure 16c, adopting multiple modeling methods to generate models and comparing the subsequent modeling results.
The methods used for comparison include the 3D Delaunay triangulation surface reconstruction method based on surface growth in the CGAL V5.0 library [56], the implicit surface modeling method in the common point cloud modeling software Geomagic [57], and the surface modeling method in the 3D CAD open source library OpenCASCADE V4.7.0. The 3D Delaunay triangulation surface reconstruction method in CGAL is able to reconstruct the point cloud models of terrain scanning, building scanning and fine scanning. The WRAP surface reconstruction algorithm used by Geomagic Studio V11 is an implicit surface algorithm. OpenCASCADE is a software development platform providing 3D surface modeling and solid modeling, CAD data exchange, and visualization, which can be used to develop CAD, CAM and CAE related software.

Results and Discussion
In order to validate the exceptional accuracy and practicability of the proposed algorithm at modeling the underground cable well point cloud data with holes, we utilize three different types of cable well wall data: the curved surface point cloud data Figure 16a, the rectangular planar point cloud data Figure 16b and the irregular planar point cloud data Figure 16c, adopting multiple modeling methods to generate models and comparing the subsequent modeling results.
The methods used for comparison include the 3D Delaunay triangulation surface reconstruction method based on surface growth in the CGAL V5.0 library [56], the implicit surface modeling method in the common point cloud modeling software Geomagic [57], and the surface modeling method in the 3D CAD open source library OpenCASCADE V4.7.0. The 3D Delaunay triangulation surface reconstruction method in CGAL is able to reconstruct the point cloud models of terrain scanning, building scanning and fine scanning. The WRAP surface reconstruction algorithm used by Geomagic Studio V11 is an implicit surface algorithm. OpenCASCADE is a software development platform providing 3D surface modeling and solid modeling, CAD data exchange, and visualization, which can be used to develop CAD, CAM and CAE related software.
The experimental results, illustrated in Figure 16, are qualitatively analyzed. For the same data, using Geomagic Studio V11 or Delaunay surface reconstruction, the generated model is incomplete, as the missing point cloud part of the cable well wall surface will result in defective modeling, making it impossible to restore the overall wall model. Additionally, as the pipe holes are unrecognizable and, due to the existence of other distortions, the pipe holes in the wall cannot be separately modeled, the pipe holes in the modeled wall lack the physical definition of the "pipe hole" in the 3D space, and the topological relationship between them and the wall surface is also ambiguous, resulting in creating inaccurate cable connections in the well. While modeling with the 3D modeling algorithm of OpenCASCADE V4.7.0 is accurate for the rectangular plane wall surface and polygonal plane wall surface, curved wall surface distortions occur when performing the topological operation on the curved wall surface. However, with the proposed algorithm in this study, there are no disruptions in the overall modeling of the wall surface, and the pipe hole model of the wall surface can be completely constructed to provide a topological structure that can accurately accomplish the subsequent cable connections in the well. The experimental results, illustrated in Figure 16, are qualitatively analyzed. For the same data, using Geomagic Studio V11 or Delaunay surface reconstruction, the generated model is incomplete, as the missing point cloud part of the cable well wall surface will result in defective modeling, making it impossible to restore the overall wall model. Additionally, as the pipe holes are unrecognizable and, due to the existence of other distortions, the pipe holes in the wall cannot be separately modeled, the pipe holes in the modeled wall lack the physical definition of the "pipe hole" in the 3D space, and the topological relationship between them and the wall surface is also ambiguous, resulting in creating inaccurate cable connections in the well. While modeling with the 3D modeling algorithm of OpenCASCADE V4.7.0 is accurate for the rectangular plane wall surface and polygonal plane wall surface, curved wall surface distortions occur when performing the topological operation on the curved wall surface. However, with the proposed algorithm in this study, there are no disruptions in the overall modeling of the wall surface, and the pipe hole model of the wall surface can be completely constructed to provide a topological structure that can accurately accomplish the subsequent cable connections in the well.
From the analysis of the experimental results illustrated in Figure 17 and described in Table 2, it is observed that the use of refined surface reconstruction prolongs the modeling of the cable well body and causes some surface vacancies. Moreover, in the refined surface reconstruction, the topological relationships between all faces of the cable well and between the face and the internal cable well are not considered. However, the proposed algorithm comprehensively considers the topological relationships of the model, and has wide-ranging practicability based on the rapid construction of the cable well body model. Moreover, as shown in Figure 17, there are some vacancies regions in the original point clouds due to partial occlusion of during scanning. In this paper, the vacancies regions can be filled automatically using the fitting method for the found contour boundary, and as the area of the vacancies regions is relatively small, it will not affect each method. From the analysis of the experimental results illustrated in Figure 17 and described in Table 2, it is observed that the use of refined surface reconstruction prolongs the modeling of the cable well body and causes some surface vacancies. Moreover, in the refined surface reconstruction, the topological relationships between all faces of the cable well and between the face and the internal cable well are not considered. However, the proposed algorithm comprehensively considers the topological relationships of the model, and has wide-ranging practicability based on the rapid construction of the cable well body model. Moreover, as shown in Figure 17, there are some vacancies regions in the original point clouds due to partial occlusion of during scanning. In this paper, the vacancies regions can be filled automatically using the fitting method for the found contour boundary, and as the area of the vacancies regions is relatively small, it will not affect each method.
To evaluate the actual performance of the proposed algorithm, reference model and source model are built according to the four groups of well point cloud. The source model S is automatically constructed by the proposed algorithm, and the reference model R is manually completed by using Maya 2019. Subsequently, we reference the modeling evaluation method proposed by Khoshelham et al. [58,59] and calculated the Completeness M Comp , Correctness M Corr and Accuracy M Acc , as follows: where m and n denote the number of surfaces in reference model R and source model S. π T j p i is the perpendicular distance between a vertex point p i in the source and the corresponding surface plane π j in the reference, and r is the cut-off value, distances beyond which are excluded from the median.    As shown in Figure 18, the buffer value is set to 10 cm, and the three quantitative evaluation values are shown in Table 3. Among them, Completeness and Correctness can reach up to 0.9, and it also indicates that the accuracy of 3D modeling is related to the complexity of the model itself; the simpler the model, the higher the precision value.
( ) = ‖ ‖, ‖ ‖ ≤ (25) where m and n denote the number of surfaces in reference model and source model . ‖ ‖ is the perpendicular distance between a vertex point in the source and the corresponding surface plane in the reference, and is the cut-off value, distances beyond which are excluded from the median.
As shown in Figure 18, the buffer value is set to 10 cm, and the three quantitative evaluation values are shown in Table 3. Among them, Completeness and Correctness can reach up to 0.9, and it also indicates that the accuracy of 3D modeling is related to the complexity of the model itself; the simpler the model, the higher the precision value.   In addition, the quantitative evaluation is performed for the integrity of the internal model of the underground cable well from an object-oriented perspective, which includes tube hole integrity, cable integrity, cable connector integrity, and the correctness of tube hole connections, as shown in Figure 19 and Table 4. The results indicate that the accuracy of 3D modeling is improved 90% by the proposed method.
As described through the above experiment of the cable well model generation, the proposed algorithm can be effectively applied to different types of point cloud data and has wide applicability. The time consumption to generate each model is negligible and the spatial topological relationship is fully considered. From the modeling effect of the actual point cloud, it can be seen that the algorithm in this study can effectively meet real-time production needs. In addition to cable wells, the proposed algorithm has strong applicability to the regular point cloud data, such as a house or building with the regular flat roof. In addition, the quantitative evaluation is performed for the integrity of the internal model of the underground cable well from an object-oriented perspective, which includes tube hole integrity, cable integrity, cable connector integrity, and the correctness of tube hole connections, as shown in Figure 19 and Table 4. The results indicate that the accuracy of 3D modeling is improved 90% by the proposed method.

Conclusions
Based on the 3D terrestrial lidar point cloud, the proposed algorithm in this study reduces the overall time consumption by preprocessing the original point cloud, extracting the main axis of the point cloud by the OBB method, and achieving the orientation correction of the point cloud by the quaternion rotation. Subsequently, this study uses the adaptive method to extract the top point cloud, conducts the projection of the top point cloud, and then extracts the boundary of the projected top point cloud. Finally, based on the boundary information, the triangular patches are built to accomplish the construction of the 3D cable well model. Employing the constructed model, the pipe holes of the cable well are generated by the triangulation network cutting method. Moreover, the underground cable wells model is constructed by the Sweep method. The following conclusions can be made based on experimental testing: (1) The proposed algorithm can adapt to different underground cable well types, while fully considering the topological relationship of the cable well model. Moreover, the proposed algorithm is faster in modeling and has exceptional adaptability when compared to the predominantly used surface reconstruction algorithms.
(2) In comparison with the traditional cable well modeling, this study achieves the essential unification of internal cable wells and external point clouds, which can adequately meet the reappearance of the original scene.
However, the algorithm in this study still has significant room for improvement, such as fully integrating GIS and BIM technology for the construction and display of cable wells, and other data sources integrating modeling and application. Therefore, further research is needed to improve the related algorithms.