Coarse and fine granularity combined three-dimensional building model organization method and device, electronic equipment and storage medium
By using the K-Means algorithm for data classification and tree balance based on R-tree and octree for fine-grained organization, the problem of low data organization efficiency in the existing technology is solved, and more efficient data management and retrieval is achieved.
Patent Information
- Application Number
- CN202510087143.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-01-20
AI Technical Summary
Existing R-trees and octrees have limitations in the organization of 3D architectural model data, especially in terms of real-time and efficient data insertion, movement and update.
Using a combination of coarse and fine grain size, the three-dimensional building model data is unsupervised through the K-Means algorithm to ensure the legitimacy of the R-tree nodes and perform tree balance. Then, the single building is organized in fine grain by using the octree, integrating the data organization structure of the R-tree and the octree.
It improves the organization and management efficiency of three-dimensional building model data, especially in the application of frequently constructing and inserting data, and improves the speed of creation, inserting and retrieval.
Smart Images

Figure CN120125771A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional models, and in particular to a method, device, electronic device and storage medium for organizing a three-dimensional architectural model combining coarse and fine granularity. Background Art
[0002] With the rapid development of technologies such as smart cities, digital twins, and the metaverse, 3D model data for indoor and outdoor, above and below ground is experiencing explosive growth. [1,2] In particular, as a key element in the city, the complexity of 3D building model data is increasing day by day, which puts forward higher requirements on the organization and management of 3D building model data, especially the real-time and high efficiency in data insertion, movement and update. [3-5] Therefore, how to organize and manage building models efficiently and quickly has become a research topic that needs to be solved urgently.
[0003] Spatial indexing technology has become an important tool in the field of 3D data organization due to its efficient data organization capabilities. Spatial indexes can be divided into single structure and hybrid structure according to their structure. In the organization of 3D model data, R-tree index, quadtree and octree index are several commonly used single indexing methods. [6-8] R-tree is popular for its efficient spatial query capability, dynamic data management, self-balancing characteristics, and good adaptability to uneven data. [9-13] However, in the process of constructing the R-tree, the minimum enclosing rectangles between sibling nodes are prone to overlap, leading to the multi-path query problem. [14,15] In order to reduce the overlap of regions, the optimized version of R-tree, R+ tree, came into being. Currently, R* tree is the best optimized version. However, as the tree depth increases and the number of nodes increases, R* tree reduces overlap but increases the calculation process, and the convergence process will become longer. [16,17] In order to meet the demand for fast data convergence, many researchers choose to use quadtree to organize urban 3D data. [18-22] However, the quadtree has certain limitations in expressing fine data in three-dimensional space. To overcome this limitation, researchers have expanded the quadtree to three dimensions and developed octree indexes, including regular octrees and linear octrees. [23,24] Octree inherits the fast convergence characteristics of quadtree and converges faster than R-tree, which enables octree to effectively meet the needs of fast organization. Therefore, it is widely used in many fields such as real-time 3D scene construction and rendering, laser point cloud data management, geological model indexing, etc. [25-30]However, octree indexing also has obvious disadvantages. If the data distribution in space is uneven, the octree may become unbalanced, resulting in some branches being very deep while others are shallow. This imbalance may affect the search efficiency. Given the limitations of single indexing, many researchers have begun to explore more effective ways to organize data through hybrid indexing. For example, Zhang et al. used a quadtree and an R-tree to organize 3D electronic navigation map data [6] , Liu et al. used 3D multi-level adaptive grids and an R+-tree to manage and store 3D spatial data
[31] , Gong Jun et al. integrated an octree and an R-tree to manage point cloud data
[32] , Wang Y et al. used an octree and an R*-tree to manage geological tetrahedron model data [7] , such as Wang Yongzhi et al., Wang W et al., and Yu Anbin et al. used an octree and an R*-tree to manage point cloud data [8 ,33 ,34] . Hybrid indexing technology has been widely used in various data organizations, especially in point cloud data management. However, the research on the organization of 3D building model data is relatively insufficient. In addition, considering the large amount of point data in point cloud data, it is reasonable to choose a quickly converging octree as the primary index, but this requires determining the minimum spatial partitioning threshold of the octree and considering that uneven data distribution in spatial regions may increase the depth of the tree, thus increasing the retrieval cost. At the same time, when the R-tree and its improved versions are used as the secondary index, they mainly organize the fine-grained data at the end, and this part of the data occupies a large proportion in all data, thus increasing the time for constructing the hybrid index.
[0004] Among them, taking a single building as the basic unit means that the sum of all indivisible 3D models belonging to the building can be distinguished by building identification; the meaning of an indivisible single model and a single model is the same, which represents the model with a single unit and has not been further split or decomposed, and the same meaning is expressed in the following text.
[0005] For the above requirements for the efficient organization and management of 3D building model data, as well as the limitations of the R-tree, octree, and their existing hybrid structures in data organization. For the above problems, no effective solutions have been proposed yet.
[0006] [1] Wu Zhiqiang, Wang Jian, Li Deren, et al. Cold Thoughts Academic Talks under the Boom of Smart Cities[J]. Urban Planning Forum, 2022, (02): 1-11.
[0007] [2] Li Deren, Zhang Hongyun, Jin Wenjie. The Mission of Geo-Spatial Informatics in the New Infrastructure Era[J]. Geomatics and Information Science of Wuhan University, 2022, 47(10): 1515-22.
[0009] [3]LIFELO Z,DING J,NING H,et al.Artificial Intelligence-EnabledMetaverse for Sustainable Smart Cities:Technologies,
[0010] Applications,Challenges,and Future Directions[J].Electronics,2024,13(24):4874.
[0011] [4]LAM P-D,GU B-H,LAM H-K,et al.Digital Twin Smart City:IntegratingIFC and CityGML with Semantic Graph for Advanced 3D City Model Visualization[J].Sensors,2024,24(12):3761.
[0012] [5]XU H,OMITAOMU F,SABRI S,et al.Leveraging generative AI for urbandigital twins:a scoping review on the autonomous generation of urban data,scenarios,designs,and 3D city models for smart city advancement[J].UrbanInformatics,2024,3(1):29.
[0013] [6]ZHANG Y,ZHANG A,GAO M,et al.Research on Three-DimensionalElectronic Navigation Chart Hybrid Spatial Index Structure Based on Quadtreeand R-Tree[J].ISPRS International Journal of Geo-Information,2022,11(5):319.
[0014] [7]WANG Y,LV H,MA Y.Geological tetrahedral model-oriented hybridspatial indexing structure based on Octree and 3D R*-tree[J].Arabian Journalof Geosciences,2020,13(15):728.
[0015] [8]WANG W,ZHANG Y,GE G,et al.A Hybrid Spatial Indexing Structure ofMassive Point Cloud Based on Octree and 3D R*-Tree[J].Applied Sciences,2021,11(20):9581.
[0016] [9]GUTTMAN A.R-trees:a dynamic index structure for spatial searching[J].SIGMOD Rec,1984,14(2):47–57.
[0017]
[10] BRAKATSOULAS S,PFOSER D,THEODORIDIS Y.Revisiting R-TreeConstruction Principles[Z].Proceedings of the
[0018] 6th East European Conference on Advances in Databases and InformationSystems.Springer-Verlag.2002:149–62
[0019]
[11] ZHU Q,GONG J,ZHANG Y.An efficient 3D R-tree spatial index methodfor virtual geographic environments[J].
[0020] ISPRS Journal of Photogrammetry and Remote Sensing,2007,62(3):217-24.
[0021]
[12] ZHENWEN H,GANG L,ZHENGPING W,et al.Three-dimensional spatialindexing method of complicated geological scene;proceedings of the 2009 17thInternational Conference on Geoinformatics,F 12-14Aug.2009,2009[C].
[0022]
[13] LI C,KUAI X,HE B,et al.Visibility-Based R-Tree Spatial Index forConsistent Visualization in Indoor and Outdoor Scenes[J].ISPRS InternationalJournal of Geo-Information,2023,12(12):498.
[0023]
[14] Gong Jun,Zhu Qing,Zhang Yeting,et al.Extended Method of 3D R-Tree Index Considering Multiple Levels of Detail[J].Acta Geodaetica et Cartographica Sinica,2011,40(02):249-55.
[0024]
[15] SUHAIBAH A,UZNIR U,ANTON F,et al.3D nearest neighbour searchusing a clustered hierarchical tree structure[J].
[0025] Int Arch Photogramm Remote Sens Spatial Inf Sci,2016,XLI-B2:87-93.
[0026]
[16] SELLIS T K,ROUSSOPOULOS N,FALOUTSOS C.The R+-Tree:A Dynamic Indexfor Multi-Dimensional Objects;
[0027] proceedings of the Very Large Data Bases Conference,F,1987[C].
[0028]
[17] BECKMANN N, KRIEGEL H-P, SCHNEIDER R, et al. The R*-tree: an efficient and robust access method for points and rectangles[Z]. Proceedings of the 1990 ACM SIGMOD international conference on Management of data. Atlantic City, New Jersey, USA; Association for Computing Machinery. 1990: 322–31. 10.1145 / 93597.98741
[0029]
[18] Zhu Qing, Chen Xingwang, Ding Yulin, et al. Visual perception-driven 3D urban scene data organization and scheduling method[J]. Journal of Southwest Jiaotong University, 2017,
[0030] 52(05): 869-76.
[0031]
[19] Chen Liangchao, Li Feng. Indoor and outdoor 3D model organization and scheduling method considering multi-source LOD[J]. Science of Surveying and Mapping, 2019, 44(10): 152-7.
[0032]
[20] Chen Jing, Xu Jia, Li Mo, et al. Multi-scale data organization method for 3D models in network environment[J]. Science of Surveying and Mapping, 2011, 36(06): 182-3+54.
[0033]
[21] Wang Feng, Pan Deji, Wang Jun. Dynamic organization and scheduling method for massive 3D urban model data[J]. Journal of University of Chinese Academy of Sciences, 2015, 32(03): 409-15.
[0034]
[22] Li Jian, Lei Sui, Tian Zhihui, et al. Research on grid indexing method of point cloud data based on decimal linear quadtree[J]. Science of Surveying and Mapping, 2015, 40(04): 115-20.
[23] Zhang Yongyu, Ma Jinsong. Research on establishment and query algorithm of linear octree spatial index in 3D GIS[J]. Computer Engineering and Science, 2009, 31(02): 61-3.
[24] BI L, ZHAO H, JIAM-T. Database-oriented storage based on LMDB and linear octree for massive block model[J].
[0035] Transactions of Nonferrous Metals Society of China,2016,26(9):2462-8.
[0036]
[25] CHEN J,LIANG Y,XIE Z,et al.Automated Reconstruction of ExistingBuilding Interior Scene BIMs Using a Feature-Enhanced Point Transformer andan Octree[J].Applied Sciences,2023,13(24):13239.
[0037]
[26] Duanmu Xinghui.Research on the Construction and Visualization of 3D Substation Simulation Model Based on Unity3D[D],2023.
[0038]
[27] SU Y-T,BETHEL J,HU S.Octree-based segmentation for terrestrialLiDAR point cloud data in industrial applications
[0039] [J].ISPRS Journal of Photogrammetry and Remote Sensing,2016,113:59-74.
[0040]
[28] Wang Jinxin,Zhao Guangcheng,Lu Fengnian,et al.Sphere Geodesic Octree Mesh Method for Constructing True 3D Geological Model[J].Journal of Geo-Information Science,2019,
[0041] 21(08):1161-9.
[0042]
[29] HAN X,NI J,YIN C,et al.3D Airborne EM Forward Modeling Based onFinite-Element Method with Goal-Oriented Adaptive Octree Mesh[J].RemoteSensing,2023,15(11):2816.
[0043]
[30] Yao Wanqiang,Zheng Junliang,Chen Peng,et al.3D Point Cloud Data Compression Algorithm Based on Octree Index[J].Science of Surveying and Mapping,2016,41(07):18-22.
[0044]
[31] LIU Y, HAO T, GONG X, et al. Research on Hybrid Index Based on 3D Multi-Level Adaptive Grid and R+Tree[J].
[0045] IEEE Access, 2021, 9: 146010 - 22.
[0046]
[32] GONG Jun, KE Sheng-nan, ZHU Qing, et al. A Management Method of Laser Point Cloud Data Integrated with Octree and 3D R-Tree[J]. Acta Geodaetica et Cartographica Sinica, 2012, 41(04): 597 - 604.
[0048]
[33] WANG Yong-zhi, YANG Lu-sheng, LIAO Li-xia, et al. Storage Structure of Laser Point Cloud Data Integrated with Octree and 3D R*Tree[J]. Journal of Geo-Information Science, 2017,
[0049] 19(05): 587 - 94.
[0050]
[34] YU An-bin, MEI Wen-sheng. A Management Method of Massive Subway Tunnel Point Cloud Combined with R-Tree and Grid[J]. Geomatics and Information Science of Wuhan University, 2019, 44(10): 1553 - 9.
[0052]
[35] SEN W, CHEN L, SHUAIJIE X. Review on K-means Clustering Algorithm[J]. Journal of East China Jiaotong University, 2022, 39(05): 119 - 26.
[0053]
[36] CHO S, PARK S, CHA G, et al. Development of Image Processing for Crack Detection on Concrete Structures through Terrestrial Laser Scanning Associated with the Octree Structure[J]. Applied Sciences, 2018, 8(12): 2373.
[0054]
[37] JIANING M,JIN C,LU L J.Maximum-minimum distance clustering methodfor split-delivery vehicle-routing problem:
[0055] Case studies and performance comparisons[J].Advances in ProductionEngineering And Management,2019,14:125-35. Summary of the Invention
[0056] An embodiment of the present invention provides a three-dimensional building model organization method, device, electronic device and storage medium combining coarse and fine granularities, so as to at least solve the technical problem of the limitations existing in the R-tree and octree for organizing three-dimensional building model data in the related art.
[0057] According to one aspect of the embodiments of the present invention, a three-dimensional building model organization method combining coarse and fine granularities is provided, including: Step S10, obtaining the optimal K value under the limitation of the legal value of the R-tree, and using the K-Means algorithm on the basis of the optimal K value to perform unsupervised classification on the three-dimensional building model data with a single building as the basic unit, ensuring the legality of the R-tree nodes, and then performing tree balancing operations to ensure the balance of the R-tree. Through multiple recursive iterations, the R-tree leaf nodes containing the data of multiple single buildings are obtained; Step S20, using the octree to perform fine-grained organization on a single building. At the R-tree leaf nodes, create an octree root node for each building; allocate the monomer model data to the octree nodes, and delete the redundant nodes, and finally obtain the three-dimensional building model data organizational structure integrating the R-tree and the octree.
[0058] Optionally, the step S10 includes the following steps:
[0059] Step S101: Initialize the R-tree, create the root node, and input the 3D building model with a single building as the basic unit. Step S102: Determine the number of input buildings. If it is greater than the maximum legal entry value M of the R-tree node, go to Step S103; if it is less than or equal to M, go to Step S107. Step S103: Obtain the optimal K value K-Value under the limitation of the R-tree legal value. Step S104: Execute the K-means clustering algorithm when the K value is K-Value to obtain the clustering data array Clusters. Step S105: Adjust the number of buildings in each cluster in the clustering data array Clusters to the average value to obtain the balanced clustering array bClusters. Step S106: Determine whether the loop of the balanced clustering array bClusters is completed. If not, read the clusters in the array, create the child node childNode of the current node, and go to Step S102. The input data is the 3D building model data with a single building as the basic unit in the current cluster. If the loop is completed, go to Step S108. Step S107: Insert the single building data into the current node to complete the update of the bounding boxes of all R-tree nodes. Step S108: Recursively complete the loops of all other balanced clustering arrays to obtain the R-tree structure with a single building as the basic unit.
[0060] Optionally, Step S103 includes the following steps, where N is the total number of buildings in the current node, m is the minimum legal entry value of the R-tree node, and M is the maximum legal entry value of the R-tree node:
[0061] S1031: Under the limitation conditions of MaxK and maxDelta, find the optimal K value K1 by comparing the SSE values. 1032: If the K1 value is less than the minimum legal entry value m of the R-tree node, take the most appropriate K value K-Value as m; if m ≤ K1 ≤ M, select the K-Value as K1. S1033: Calculate the number of buildings N, that is, the total number of buildings in the current node. If add 1 to the K-Value until stop to obtain the optimal K value K-Value under the limitation of the R-tree legal value.
[0062] Optionally, the maximum minimum distance method is adopted to select the initial clustering center in the K-Means algorithm.
[0063] Optionally, Step S20 includes the following steps:
[0064] Step S201: Obtain the R-tree structure with a single building as the basic unit, and determine whether the leaf nodes of the R-tree have completed a loop. When the loop is not completed, proceed to the next step. When the loop is completed, the 3D building model data structure integrating the R-tree and the octree is obtained. Step S202: Create the root node of the octree based on the leaf nodes of the R-tree, and obtain the minimum cubic bounding box of the single building as the range of the octree root node. Step S203: Determine whether the insertion of the single building model of the current building is completed. When the insertion is completed, proceed to step S207. When the insertion is not completed, proceed to step S204. Step S204: Determine whether the expansion value of the current node is less than the minimum area threshold Minl of the octree division. When the current node < Minl, stop the judgment, insert the current node, and then return to step S203 for re-judgment. Conversely, when the current node ≥ Minl, perform octree division and proceed to step S205. Step S205: When the single building model is surrounded by the current node area but not by the area of any child node of the current node, insert the current node, and then return to the previous step S203 for re-judgment. Conversely, proceed to the next step, i.e., step S206. Step S206: When the single building model is surrounded by the current node area and by the area of any child node of the current node, set this child node as the current node and proceed to step S204. Step S207: Delete unnecessary nodes. Unnecessary nodes are blank nodes. If a child node and its sibling nodes have neither child nodes nor data, delete all child nodes pointed to by the parent node in this child node.
[0065] Optionally, the 3D building model data organizational structure integrating the R-tree and the octree includes: the root node, intermediate nodes, and leaf nodes of the R-tree and the octree. Among them, the root node and intermediate nodes of the R-tree do not contain pointers pointing to the root node of the octree, so the pointer array OcPtrs pointing to the root node of the octree is empty. The leaf nodes of the R-tree do not contain pointers pointing to other child nodes, so Children is empty. The root node of the octree is located at the top layer, that is, it does not point to any parent node, and its Parent value is empty. When entering the root node, the building identification value BuildID is recorded only once, and the BuildID value is not stored in the intermediate nodes and leaf nodes. The leaf nodes do not contain pointers pointing to child nodes, so Children is empty.
[0066] According to another aspect of the embodiments of the present invention, there is also provided a three-dimensional building model organization device that combines coarse and fine granularities, including: obtaining the optimal K value under the limitation of the legal values of the R-tree, and then using the K-Means algorithm based on the optimal K value to perform unsupervised classification on the three-dimensional building model data with single buildings as the basic units, ensuring the legality of the R-tree nodes, and then performing tree balancing operations to ensure the balance of the R-tree. Through multiple recursive iterations, the leaf nodes of the R-tree containing the data of multiple single buildings are obtained; an octree fine-grained organization module is used to perform fine-grained organization on single buildings using the octree. At the leaf nodes of the R-tree, an octree root node is created for each building; the single model data is assigned to the octree nodes, and the redundant nodes are deleted, and finally a data organizational structure integrating the R-tree and the octree is obtained.
[0067] According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including: a memory storing an executable program; a processor for running the program, wherein when the program runs, it executes the methods in the various embodiments of the present invention.
[0068] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, where the computer-readable storage medium includes a stored executable program, and wherein when the executable program runs, it controls the device where the computer-readable storage medium is located to execute the methods in the various embodiments of the present invention.
[0069] According to another aspect of the embodiments of the present invention, there is also provided a computer program product, including a computer program, and the computer program implements the methods in the various embodiments of the present invention when executed by a processor.
[0070] According to another aspect of the embodiments of the present invention, there is also provided a computer program product, including a non-volatile computer-readable storage medium storing a computer program, and the computer program implements the methods in the various embodiments of the present invention when executed by a processor.
[0071] According to another aspect of the embodiments of the present invention, there is also provided a computer program, and the computer program implements the methods in the various embodiments of the present invention when executed by a processor.
[0072] In an embodiment of the present invention, a method for organizing a three-dimensional building model combining coarse and fine granularity is provided. The method obtains an optimal K value under the limitation of the legal value of the R-tree, and then uses the K-Means algorithm on the basis of the optimal K value to perform unsupervised classification on the three-dimensional building model data with a single building as the basic unit, to ensure the legality of the R-tree node, and then performs a tree balancing operation to ensure the balance of the R-tree. Through multiple recursive iterations, an R-tree leaf node containing multiple single building data is obtained; an octree is used to organize a single building in fine granularity, and an octree root node is created for each building at the R-tree leaf node; the monomer model data is assigned to the octree node, and redundant nodes are deleted, and finally a three-dimensional building model data organization structure that integrates the R-tree and the octree is obtained. That is, the octree is used to organize the data in fine granularity, the depth of the tree is reduced, and the overall structure is more biased towards a balanced tree, thereby solving the technical problem of the limitations of the R-tree and the octree in the related technology on data organization, and providing support for the three-dimensional building model data organization. Experiments show that this data structure method is superior to R-tree and octree in terms of creation speed and insertion speed, and is also faster than octree in terms of retrieval speed, especially for retrieval of small areas. It can meet the needs of efficient organization and management of 3D building models, especially in applications that require frequent construction and insertion of 3D building model data. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0074] Figure 1 is a flow chart of a method for organizing a three-dimensional building model combining coarse and fine granularity according to an embodiment of the present invention;
[0075] Figure 2 is a flow chart of a method for organizing a three-dimensional building model combining coarse and fine granularity according to an embodiment of the present invention;
[0076] Figure 3 Schematic diagrams of two situations presented by octree nodes after cyclically inserting three-dimensional model data of a single building through Algorithm 4 according to an embodiment of the present invention;
[0077] Figure 4 is a schematic diagram of a three-dimensional building model data structure integrating an R-tree and an octree according to an embodiment of the present invention;
[0078] Figure 5 is a schematic diagram of a bird's-eye view of the entire scene and extracted building data and some local data details according to an embodiment of the present invention;
[0079] Figure 6 is the visualization effect diagram of the experimental results of the R-tree, octree, and this method according to the embodiments of the present invention;
[0080] Figure 7 is the visualization effect diagram of the local data division of this method when using data 4 for experiments according to the embodiments of the present invention - schematic diagram of the area overlap between multiple octrees;
[0081] Figure 8(a) is the schematic diagram of the local visualization effect of this method when taking data 4 for experiments according to the embodiments of the present invention - the effect of a nearly square building surrounded by the root node of the octree;
[0082] Figure 8(b) is the schematic diagram of the local visualization effect of this method when taking data 4 for experiments according to the embodiments of the present invention;
[0083] Figure 9 is the schematic diagram of a three-dimensional building model organization device combining coarse and fine granularities according to the embodiments of the present application;
[0084] Figure 10(a) is the schematic diagram of the single building model dragging and placing function according to the embodiments of the present invention;
[0085] Figure 10(b) is the schematic diagram of the function of generating a three-dimensional building model by regional parameterization according to the embodiments of the present invention;
[0086] Figure 10(c) is the schematic diagram of the building model splitting and attribute query according to the embodiments of the present invention;
[0087] Figure 10(d) is the schematic diagram of the building height limit analysis according to the embodiments of the present invention;
[0088] Figure 10(e) is the schematic diagram of the building skyline analysis according to the embodiments of the present invention;
[0089] Figure 10(f) is the schematic diagram of the building wind force analysis according to the embodiments of the present invention. Detailed implementation manners
[0090] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0091] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0092] According to one aspect of an embodiment of the present invention, a three-dimensional building model organization method combining coarse and fine granularities is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0093] Figure 1 is a flowchart of a three-dimensional building model organization method combining coarse and fine granularities according to an embodiment of the present invention, as Figure 1 shown, the method includes the following steps:
[0094] Step S10, obtain the optimal K value under the limitation of the legal value of the R-tree, and then use the K-Means algorithm on the basis of the optimal K value to perform unsupervised classification on the three-dimensional building model data with a single building as the basic unit to ensure the legality of the R-tree nodes, and then perform a tree balancing operation to ensure the balance of the R-tree. Through multiple recursive iterations, obtain the R-tree leaf nodes containing the data of multiple single buildings; that is, realize the R-tree coarse-grained data organization of single buildings.
[0095] Step S20, use an octree to perform fine-grained organization on a single building. At the R-tree leaf node, create an octree root node for each building; allocate the monomer model data to the octree nodes, and delete the redundant nodes, and finally obtain a three-dimensional building model data organizational structure integrating the R-tree and the octree.
[0096] The above two steps can be specifically divided into two levels. The specific flowchart is as Figure 2 shown, Figure 2 shows the flowchart of the three-dimensional building model organization method combining coarse and fine granularities. In Figure 2Among the input parameters, M and m are the maximum and minimum legal entry values of the R-tree, maxDelta is the threshold for finding the optimal K value in K-value clustering (a smaller value means a better number of clusters K, but the computational cost will increase), maxK is the maximum limit value for finding the optimal K value in K-value clustering, MinL is the minimum area threshold for octree partitioning, and Data is a three-dimensional building model with a single building as the basic unit. In view of the uneven spatial distribution of building data, the present invention first constructs an R-tree with a single building as the basic unit to achieve coarse-grained data organization. The construction of tree nodes in S10 above will adopt a top-down and depth-first strategy, starting from the root node and gradually constructing child nodes downward until reaching the leaf nodes of the R-tree.
[0097] Continue to refer to Figure 2 , step S10 specifically includes the following steps:
[0098] Step S101, initialize the R-tree, create a root node, and input a three-dimensional building model with a single building as the basic unit;
[0099] Step S102, judge the number of input buildings. If it is greater than the maximum legal entry value M of the R-tree node, go to step S103; if it is less than or equal to M, go to step S107;
[0100] Step S103, obtain the optimal K value K-Value (K-ValueForRtree) under the limitation of the legal value of the R-tree;
[0101] Step S104, execute the K-means clustering algorithm when the K value is K-Value to obtain a clustering data array Clusters;
[0102] Step S105, perform a tree balancing operation to adjust the number of buildings in each cluster in the clustering data array Clusters to the average value, and obtain a balanced clustering array bClusters to ensure the balance of the R-tree and thus reduce the depth of the tree;
[0103] Step S106, judge whether the loop of the balanced clustering array bClusters is completed. If not, read the clusters in the array, create a child node childNode of the current node, and go to step S102. The input data is the three-dimensional building model data with a single building as the basic unit in the current cluster; if the loop is completed, go to step S108;
[0104] Step S107, insert the single building data into the current node to complete the update of the bounding box of each node of the R-tree;
[0105] Step S108, recursively complete the loop of all other balanced clustering arrays to obtain an R-tree structure with a single building as the basic unit.
[0106] As an alternative embodiment, the above step S10 can be represented by Algorithm 1:
[0107]
[0108] The above step S103 specifically includes the following steps, where N is the total number of building blocks in the current node, m is the minimum legal entry value of the R-tree node, and M is the minimum legal entry value of the R-tree node:
[0109] S1031, under the limiting conditions of MaxK and maxDelta, find the optimal K value K1 by comparing the SSE values.
[0110] S1032, if the value of K1 is less than the minimum legal entry value m of the R-tree node, take the most suitable K value K-Value as m; if m ≤ K1 ≤ M, select the K-Value as K1;
[0111] S1033, calculate the number of building blocks N of the building. If add 1 to the K-Value until stop, and obtain the optimal K value K-Value under the limitation of the legal value of the R-tree.
[0112] As an alternative embodiment, the above step S103 can be represented by Algorithm 2:
[0113]
[0114] Finding the optimal K value in the K-Means algorithm is crucial. The present invention uses the sum of squared errors (SSE) of points as the selection condition for the K value, that is, compare whether the difference in SSE values between the two clustering cases of K and K-1 is less than the threshold. If the difference is less than the set threshold maxDelta, it is considered that the current K value can better classify the data. The setting of this threshold aims to find the elbow point of the K value change curve, that is, after this point, the increase in the K value no longer significantly improves the clustering effect. [35,36] . The calculation of the SSE value is as follows in Equation (1).
[0115]
[0116] In the formula: C j is the j-th clustering center, Pi is the data point data set with the bottom i, k is the number of clusters, and n is the number of data sets.
[0117] In addition to the selection of the K value, another crucial step in the K-Means algorithm is the determination of the initial cluster centers. To improve the efficiency and quality of clustering, this application uses the maximum-minimum distance method to select the initial cluster centers.
[37] This method selects the point farthest from the existing cluster centers as the new cluster center, thereby reducing the number of iterations in the clustering process and improving the stability of clustering.
[0118] Each node of the R tree has a limit on the minimum legal entry value m and the maximum legal entry value M of the R tree node. Therefore, for the optimal K value obtained by judging the SSE value difference, there may be three cases: K < m, K > M, and m ≤ K ≤ M. For this reason, when the maximum limit value of the number of clusters is restricted, MaxK = M. So, the remaining two cases are K < m and m ≤ K ≤ M. To conform to the legal values, when K < m, K will be directly set equal to the m value, and when m ≤ K ≤ M, no additional modification is required.
[0119] However, when clustering using the above K value, there may be a situation where the number of entries in the leaf node is less than m, resulting in an illegal leaf node. For this reason, the present invention uses formula (2) for judgment. If it holds, it means that the child nodes created by this node and the nodes created by the child nodes will have an entry value less than m. By using formula (3), the data entries S1 of the child nodes of the current node can be calculated. When the number of clusters is m, the maximum number of entries in each cluster. Therefore, formula (4) can be used to calculate whether the entry value of the child node's child node of the current node is legal. That is, the combined expression of formula (3) and formula (4) is formula (2). When using the K value to create an illegal leaf node, the optimization method adopted in this article is to increase the K value, making the entry value of each cluster smaller, so that the child nodes of this node conform to the legal value, that is, satisfy formula (5). Instead of having its child nodes create leaf nodes, the node itself directly creates leaf nodes.
[0120] When the above K value is M and still cannot satisfy formula (5), this K value is allowed to exceed the M value because choosing to adjust further to its parent node has a high algorithm cost and is complex. In addition, there is still a possibility of being illegal when recursively adjusting to the root node. And there is a certain compatibility between the values of m and M. The situation where increasing the K value still cannot satisfy formula (5) is relatively rare. Therefore, the method of allowing this K value to exceed the M value has the least cost.
[0121]
[0122]
[0123] In the above formula: N is the total number of building blocks in the current node, K-Value represents the currently used K value, S1 is the entry value of the child node of the current node, m is the minimum legal entry value of the R-tree node, and M is the minimum legal entry value of the R-tree node.
[0124] The above step S105 specifically includes the following steps:
[0125] S1051, according to the average value of the clustered building blocks, divide the clusters into a super-average cluster set and a below-average cluster set;
[0126] S1052, find the super-average cluster closest to the below-average cluster in the super-average cluster set, and use the cluster center to judge the distance;
[0127] S1053, find the target single building closest to the center of the below-average cluster in the super-average cluster, and use the center of the minimum bounding box of the single building and the cluster center for discrimination;
[0128] S1054, move the target single building to the below-average cluster, and execute until the number of building blocks in each cluster reaches the average value.
[0129] For further reference Figure 2 , when the spatial division is further refined to single buildings, an octree will be used for fine-grained organization. Since the spatial distribution of some models inside the building is relatively wide, covering multiple directions such as up, down, left, and right, it is more suitable to use an octree for organization and division. In addition, for complex buildings composed of multiple single models, if the R-tree is continued to be used for division, it will be very time-consuming, while using an octree to organize and divide data can significantly improve the calculation efficiency. The purpose of this step is to find the most suitable octree node to organize the data. Step S20 specifically includes the following steps:
[0130] Step S201, obtain the R-tree structure with single buildings as the basic unit, and judge whether the leaf nodes of the R-tree have completed the loop; when the loop is not completed, enter step S202; when the loop is completed, the three-dimensional building model data structure integrating the R-tree and the octree is obtained;
[0131] Step S202, create the root node of the octree according to the leaf nodes of the R-tree, and obtain the minimum cubic bounding box of the single building as the range of the octree root node;
[0132] Step S203, judge whether the insertion of the single model of the current building is completed. When the insertion is completed, enter step S207; when the insertion is not completed, enter step S204;
[0133] Step S204: Determine whether the expansion value of the current node is less than the minimum area threshold Minl of the octree division. When the current node < Minl, stop the judgment, insert the current node, and then return to step S203 for re-judgment; conversely, when the current node ≥ Minl, perform octree division and enter step S205;
[0134] Step S205: When the single building model is surrounded by the current node area but not by the area of any child node of the current node, insert the current node, and then return to the previous step S203 for re-judgment; conversely, enter the next step, that is, step S206;
[0135] Step S206: When the single building model is surrounded by the current node area and by the area of any child node targetChild of the current node, set the child node targetChild as the current node and enter step S204;
[0136] Step S207: Delete unnecessary nodes. Unnecessary nodes are blank nodes. If a child node and its sibling nodes have neither child nodes nor data, delete all child nodes pointed to by the parent node in that child node.
[0137] As an optional embodiment, part of the process of step S20 can refer to Algorithm 3.
[0138]
[0139]
[0140] Among them, Algorithm 4 is a recursive division supplement to Algorithm 3. It should be noted that after the octree root node Node calls OctreeInsertDatas (Algorithm 3), unnecessary nodes need to be deleted because after organizing the data through Algorithm 5, the leaf nodes of the octree will show two situations: one is as Figure 3 (a) shows that the spatial division of the single model data of the building does not reach the minimum division length, and multiple blank child nodes may be generated; the other is as Figure 3As shown in (b), the spatial division of the single - building model data reaches the minimum division length. In the first case, when determining whether the single - building model is within the range of a certain octree node, it is necessary to determine whether the model is surrounded by any child node to find the most suitable octree node for the model (i.e., the smallest surrounding area, which cannot be contained by any child node). Therefore, Algorithm 4 will generate child nodes for judgment, which inevitably generates blank nodes. In the second case, since the minimum threshold of the octree spatial division has been reached and it is impossible to continue dividing downwards, the single - building model of the building will be inserted into the leaf nodes of the octree. To improve the query efficiency, it is necessary to delete the blank nodes in the first case. In Algorithm 4, when the model is added to the appropriate node of the octree, the blank child nodes are not immediately deleted. This is because there is more than one single - building model to be inserted into the octree, and the child nodes may be used by other models for insertion. Therefore, it is more efficient to delete the child nodes uniformly after all single - building models of the entire building have been inserted (i.e., after Algorithm 4 is executed). Specifically, if the sibling nodes of a certain child node have neither child nodes nor data, then all child nodes pointed to by the parent node in this child node should be deleted.
[0141] Figure 4 shows a schematic diagram of the 3D building model data structure integrating the R - tree and the octree. Among them, as Figure 4 shown in (a), the R + octree node data structure includes the root node, intermediate nodes, and leaf nodes of the R - tree and the octree. The R - tree node consists of the following elements: node level (Level), center of the minimum bounding box (Center), extensions of the bounding box center in the X, Y, and Z directions (Extend), pointer array to child nodes (Children), and pointer array to the octree root node (OcPtrs). It should be noted that the root node and intermediate nodes of the R - tree do not contain pointers to the octree root node, so OcPtrs is empty; while the leaf nodes of the R - tree do not contain pointers to other child nodes, so Children is empty. The octree node consists of node level (Level), center of the cubic bounding box (Center), extensions of the bounding box center in the X, Y, and Z directions (Extend), building identifier (BuildID), pointer to the parent node (Parent), pointer array to child nodes (Children), and pointer array to the building model (Mesh). The root node of the octree is at the topmost layer, so it does not point to any parent node, and its Parent value is empty. The building identifier value BuildID is recorded only once when entering the root node, and the intermediate nodes and leaf nodes do not store the BuildID value. The leaf nodes do not contain pointers to child nodes, so Children is empty.
[0142] As Figure 4 The 3D building model unit data structure shown in (b), whose main design idea is to clearly express the geometric data, material data, topological data, and attribute data of the model. ① Geometric data is expressed through the hierarchical association relationship between multiple elements such as volume, surface, line, and point in the data structure; ② Material data is associated with the material structure through the material identifier (MaterialID) in the surface structure, and is specifically described by the material detail structure (MaterialDetail) in the material structure, including information such as color, texture, metallicity, and roughness (as shown in Table 1 specifically). ③ Topological data is expressed by the geometric relationship of volume, surface, line, and point in the data structure. ④ Attribute data adds an attribute field (Attribute) in the volume data structure, surface data structure, line data structure, and element structure to express the attribute data of the building and the model. Among them, the element structure is associated by the BuildID in the octree to express the attribute information belonging to a single building. The schematic representation of the building model in the 3D scene is as shown in Figure 4 (e)4(f), Figure 4 (e) represents the data contained in the root node of the R tree, Figure 4 (d) represents the spatial division of the 3D building model by the octree. The non-separable 3D building model of a single entity (such as Figure 4 (e)) will be divided into the Mesh pointer array. The non-separable 3D building model of a single entity is represented by the geometric and material data in Figure 4 (f).
[0143] Table 1. Explanation of the material data structure and its fields
[0144]
[0145] To evaluate the performance and effect of the present invention when processing building data of different scales and complexities, so that those skilled in the art can better understand the present invention:
[0146] The building data in the metaverse platform is selected as the experimental object, Figure 5 (a) shows an aerial view of the entire scene, Figure 5 (b) shows the extracted building data. Four sets of experimental data are designed for the response and efficiency under the condition of simulated data increment. Each set of experimental data involves Figure 5(b) Combinations of different regions. Table 2 details the key metrics for each group of experiments, including the number of buildings, the number of individual models, the number of scene vector points, and the number of scene textures. Among them, the number of components refers to the smallest separable models in the scene. In terms of the software and hardware conditions of the experiment, this application selects Unreal Engine 5 (UE5) as the 3D rendering engine for data, and the implementation of the algorithm adopts a combination of C++ language and UE blueprint language. The hardware devices are CPU 12th Gen Intel(R) Core(TM) i9-12900K, GPU NVIDIA GeForce RTX 3090Ti, and 128GB Kingston memory modules.
[0147] Table 2 Experimental data information
[0148]
[0149] To maintain the comparability of various methods in the experiment, a unified parameter setting is adopted for the implementation. For the R-tree, the maximum fan-out parameter M is set to 30, the minimum value m is 15, and the maxDelta value is 100 cm 2 , the maximum limit value of the number of clusters MaxK is 15. The difference is that the R-tree index is directly divided into individual model data, while only a coarse-grained division is performed in the R-tree part of this method. Similarly, the parameter settings of the octree are also consistent with the octree part of this method. The minimum division limit of the grid body is 10 cm. The difference is that the organization method of the octree is directly from the maximum range to the individual data, while only a fine-grained division is performed in the octree part of this application. When comparing the retrieval speeds of the methods, this application uses the region query method to query the building model data in the space. Taking the minimum bounding box of each experiment data as the benchmark, the length, width, and height of the bounding box are divided into 10 equal parts, and the data is queried in increments to test the differences in retrieving data by different methods at different scales. Each retrieval is performed 10 times and then the average value is taken, and the total time of 10 retrievals is recorded. The visualization rendering results of the experimental results are as follows Figure 6As shown, Figures (a1), (b1), (c1), and (d1) respectively show the visualization effects of the R-tree under experimental data 1 to 4; Figures (a2), (b2), (c2), and (d2) show the visualization effects of the octree under experimental data 1 to 4; Figures (a3), (b3), (c3), and (d3) show the visualization effects of the method of the present application under experimental data 1 to 4. From the observation results, it can be found that in the visualization effect of the R-tree, the buildings are surrounded by tightly packed bounding boxes, showing a high space utilization rate; while the octree starts from a large cubic bounding box and is gradually subdivided until it converges to the building area, with a relatively low space utilization rate; the method used in the present application compresses the space division range to the building area and then divides the space of each individual building, achieving a relatively balanced space utilization rate. Figure 7 The local visualization results when using experimental data 4. Since its data volume is the largest in the experimental data group, it is convenient to observe the effects of each method on processing a large amount of data. By comparing the data of the two outdoor scenes represented by Figures (a1), (a2), (a3) and Figures (b1), (b2), (b3), and the data of the two indoor scenes represented by Figures (c1), (c2), (c3) and Figures (d1), (d2), (d3), a consistent conclusion can be drawn: the R-tree has the highest space utilization rate, the octree has the lowest space utilization rate, and the method of the present application achieves a balanced space utilization.
[0150] The construction time required for each method is shown in Table 3 below. Among them, the construction times of the R-tree, octree, and the present method increase with the increase of the experimental data volume. The construction time of the R-tree is much more than that of the octree and the present method, and the construction time of the octree is more than that required by the present method. The present method obtains a maximum improvement of 41.25% when using experimental data 4 and at least 32.87% improvement when using experimental data 1. The total number of nodes of each method is shown in Table 4 below. Among them, the nodes of the R-tree, octree, and the present method increase with the increase of the experimental data. The number of nodes of the R-tree is much less than that of the octree and the present method. The number of nodes of the present method is less than that of the octree in data 1 - 3, but more than that of the octree in data 4. The retrieval time required for each method is shown in Table 5 below. Among them, the retrieval times of the R-tree, octree, and the present method increase with the increase of the experimental data. The time required by the R-tree is less than that of the octree and the present method, and the retrieval time of the octree is more than that of the present method.
[0151] Table 3 Construction time. (Time / ms)
[0152]
[0153] Table 4 Number of nodes
[0154]
[0155] Table 5 Retrieval Time (Time / ms)
[0156]
[0157]
[0158] It can be obtained through experimental data analysis that:
[0159] (1) In terms of construction speed:
[0160] The process of data organization and construction is the process of inserting data into nodes. Therefore, the speed of construction can also be regarded as an intuitive manifestation of the speed of insertion. The R-tree lags far behind this method and the octree in terms of construction and insertion speed. The main reason is that it requires a large amount of unsupervised classification calculations during the data clustering process. In addition, whenever new data is inserted, the R-tree needs to update its clustering structure and re-perform the tree balancing calculation. After all the data is inserted, it is also necessary to start from the leaf nodes and gradually update the bounding box information upwards. This method has a significant improvement in construction and insertion rates compared to the octree because this method first constructs R data for the three-dimensional building model data, focusing the space division on the data-intensive areas, thus greatly compressing the depth of the tree. In contrast, the octree divides from the entire scene from top to bottom, and the smaller single models are insignificant relative to the bounding box of the octree in the whole scene. In a complex three-dimensional building model, the number of smaller single models is large and they are usually assigned to deeper octree nodes. Therefore, the octree requires more time in the construction and creation process, thus lagging behind this method. However, the insertion efficiency of the octree is still much higher than that of the R-tree, so its insertion speed is still faster than that of the R-tree.
[0161] (2) In terms of the number of nodes:
[0162] The number of nodes in the R-tree is less than that in the octree and this method because the R-tree can organize spatial data more effectively and reduce the number of nodes through adaptive spatial partitioning and flexible node capacity. The octree and this method both use recursive partitioning with fixed rules, which will generate a large number of nodes that are empty or inefficient. Another manifestation is that after the R-tree organization at a coarse-grained level, this method has aggregated the partitioning regions around the buildings, but the number of nodes is relatively close to that of the octree and this method. This is because for the octree part of this method, a cubic bounding box for the building needs to be established, so the maximum value among the length, width, and height is taken as the partitioning length, resulting in the overlap of multiple octrees in space and the generation of a large number of nodes. As shown in Figure 8(a), it is the local visualization effect when using Data 4 for the experiment. The rectangle 1-3-4-6 is the octree bounding box of Building 1, the rectangle 7-8-9-10 is the octree bounding box of Building 2, and the overlapping region is the rectangle 2-3-4-5. When organizing the data in Region A, it can only be assigned to the octree nodes of Building 1. Although node partitioning has also been performed on Building 2 in space, since the algorithm performs octree partitioning on a single building basis, the data of Building 1 cannot be inserted into the octree nodes of Building 2. Ideally, as shown in Figure 8(b), the octree bounding box can exactly enclose the building, but the minimum bounding boxes of many buildings are not close to squares.
[0163] (3) In terms of retrieval speed:
[0164] The retrieval speed of the R-tree is relatively fast because the size and shape of the regions stored in each node are adaptive, which can enclose the data more compactly. In addition, the R-tree is a balanced tree with a relatively high tree depth and node utilization rate, which can reduce the query time, while the octree and this method will both result in a large number of inefficient nodes. However, the retrieval speed of this method is faster than that of the octree because this method uses the R-tree organization method at a coarse-grained level. Although the number of their nodes is relatively close, the tree depth of this method is much shallower than that of the octree, so faster retrieval can be performed. As shown in Tables 6 to 9 below, in the experiment, the retrieval range for Data 1 to Data 4 is gradually increased, and by observing the retrieval time, it can be found that the advantage of this method is more obvious when the query range is smaller. Because the octree needs to query downward from a relatively large range of space for data retrieval, and the target region is relatively small, more time is required to query the target. In addition, when performing a global query (10 / 10 of the bounding box), the query time of the octree and this method will be proportional to the number of nodes because at this time both indexes need to traverse all nodes. In Data 4, the number of nodes generated by organizing according to this method is more than that of the octree, and the time for global query will also be more than that of the octree.
[0165] Table 6 Retrieval time when using Data 1 for the experiment with the bounding box from small to large, and the time unit is ms
[0166]
[0167] Table 7 Retrieval times of bounding boxes from small to large when using Data 2 for experiments, with the time unit being ms
[0168]
[0169] Table 8 Retrieval times of bounding boxes from small to large when using Data 3 for experiments, with the time unit being ms
[0170]
[0171] Table 9 Retrieval times of bounding boxes from small to large when using Data 4 for experiments, with the time unit being ms
[0172]
[0173]
[0174] (4) In terms of application scenarios:
[0175] In this experiment, different data organization methods showed their respective advantages and characteristics. In the most complex scenario, when performing a global (10 / 10 of the minimum bounding box) retrieval of experimental data 4, this method was only 31.28 milliseconds slower than the fastest R-tree, but the construction speed was nearly 357 times faster than the 260.72 seconds of the R-tree, that is, it only took 728.37 milliseconds. In addition, this method is superior to the octree in terms of construction and insertion speed and retrieval speed. Therefore, this method can provide an excellent experience for the organization and management of three-dimensional building models, especially in scenarios where three-dimensional building model data needs to be frequently constructed and inserted. The retrieval speed in the experiment was only 31.28 milliseconds slower, a gap that is almost imperceptible to the naked eye and consciousness, and when the construction speed is only 260.72 seconds, the user experience will be significantly affected. As shown in Figure 10, with the support of the method of this application, many applications based on the organizational structure of three-dimensional buildings have been developed in the Metaverse platform, and the experience and effects of these applications are good. Figure 10(a) is a single building model drag and drop function, which is inserted data in the data structure of this application; Figure 10(b) is a regional parameterized three-dimensional building model generation function, which selects the required regional model generation, and then adds it to the generation list, adjusts the weights of various model generation, and the generation density, and then generates models in the scene. In the data structure of this application, a large amount of data is inserted; Figure 10(c) is a building model splitting and attribute query, which is used to retrieve the attribute data of the building model in the data structure; Figure 10(d) is a building height limit analysis, Figure 10(e) is a building skyline analysis, and Figure 10(f) is a building wind analysis, which requires a comprehensive query of the topological data, geometric data, and attribute data in the data structure of this application.
[0176] The present invention provides a method for organizing three-dimensional building models with a combination of coarse and fine granularity. The method uses an R-tree to organize data at a coarse granularity, and then uses an octree to organize data at a fine granularity. The depth of the tree is reduced, and the overall structure is more biased towards a balanced tree, providing support for the data organization of the three-dimensional data model. Experiments have shown that the method is superior to the R-tree and the octree in terms of creation speed and insertion speed, and is also faster than the octree in terms of retrieval speed, especially for retrieval of small areas. It can meet the requirements of efficient organization and management of three-dimensional building models, especially in applications that require frequent construction and insertion of three-dimensional building model data.
[0177] According to another aspect of an embodiment of the present invention, a device for organizing a three-dimensional building model with a combination of coarse and fine granularity is also provided. The system can execute the method for organizing a three-dimensional building model with a combination of coarse and fine granularity of the above embodiment. The specific implementation method and preferred application scenario are the same as those of the above embodiment and will not be repeated here.
[0178] Figure 9It is a schematic diagram of a three-dimensional building model organization device combining coarse and fine granularities according to an embodiment of the present application. As Figure 9 shown, the device includes the following:
[0179] The R-tree coarse-grained organization module 10 is used to obtain the optimal K value under the limitation of the legal values of the R-tree, and then use the K-Means algorithm based on the optimal K value to perform unsupervised classification on the three-dimensional building model data with single buildings as the basic unit to ensure the legality of the R-tree nodes, and then perform tree balancing operations to ensure the balance of the R-tree. Through multiple recursive iterations, the R-tree leaf nodes containing the data of multiple single buildings are obtained; that is, the R-tree coarse-grained data organization of single buildings is realized.
[0180] The octree fine-grained organization module 20 is used to perform fine-grained organization on single buildings using the octree. At the R-tree leaf nodes, an octree root node is created for each building; the single model data is assigned to the octree nodes, and the redundant nodes are deleted, and finally the three-dimensional building model data organizational structure integrating the R-tree and the octree is obtained.
[0181] As Figure 2 shown, in the input parameters of the three-dimensional building model organization device, M and m are the maximum and minimum legal entry values of the R-tree, maxDelta is the threshold for finding the optimal K value in K-value clustering (a smaller value means a better clustering number K, but the computational amount will increase), maxK is the maximum limit value when finding the optimal K value in K-value clustering, MinL is the minimum area threshold for octree division, and Data is the three-dimensional building model data to be organized; the output parameter is the three-dimensional building model data organizational structure integrating the R-tree and the octree.
[0182] An embodiment of the present application also provides an electronic device, including: a memory storing an executable program; a processor for running the program, wherein when the program runs, it executes the methods in the various embodiments of the present invention. The above-mentioned memory may refer to a device inside a computer for storing data and programs, and may include a memory, a hard disk, etc. Among them, the memory can be used to temporarily store the running programs and data, and the hard disk can be used to store programs and data for a long time. The memory can be used to enable the computer to read and write data and execute programs; the above-mentioned processor can be responsible for executing the instructions in the computer program and performing data processing, and can be responsible for controlling and executing various operations, including arithmetic operations, logical operations, data transmission, etc.
[0183] An embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium includes a stored executable program, wherein when the executable program runs, it controls the device where the computer-readable storage medium is located to execute the methods in the various embodiments of the present invention.
[0184] The above computer storage medium may refer to a medium in a computer memory for storing a certain discontinuous physical quantity. The main computer storage media include semiconductors, magnetic cores, magnetic drums, magnetic tapes, laser discs, etc.; the stored programs included in the computer-readable storage medium can be a set of instructions that can be recognized and executed by a computer, running on an electronic computer, and are information-based tools that meet certain needs of people.
[0185] An embodiment of the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the methods in various embodiments of the present invention are implemented.
[0186] The above computer program product may refer to a software program that has been written, tested, and released, and can run on a computer or other devices. The computer program product may include application programs, operating systems, tool software, etc., and is used to implement specific functions or solve specific problems.
[0187] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium for storing a computer program, and when the computer program is executed by a processor, the methods in various embodiments of the present invention are implemented.
[0188] The above non-volatile computer-readable storage medium may refer to a medium for storing data. The non-volatile computer-readable storage medium can keep the data from being lost when the power is off and can be used to store data for long-term preservation, such as operating systems, application programs, and user files. The non-volatile storage medium may include hard disk drives, solid-state drives, optical discs, and flash storage devices, etc.
[0189] An embodiment of the present application further provides a computer program, and when the computer program is executed by a processor, the methods in various embodiments of the above present invention are implemented.
[0190] The above computer program may refer to a set of instructions for telling a computer to perform specific tasks or operations. The computer program can be written by a programmer using a specific programming language and may include content such as algorithms, data structures, logic, and control flows. The computer program can be used for various purposes, including application software, operating systems, etc.
[0191] In the above embodiments of the present invention, the descriptions of each embodiment have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0192] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units can be a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings, direct couplings or communication connections shown or discussed with each other can be through some interfaces. The indirect couplings or communication connections of units or modules can be in electrical or other forms.
[0193] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0194] In addition, in each embodiment of the present invention, the functional units can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0195] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks or optical discs and other various media that can store program codes.
[0196] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A method for organizing a three-dimensional building model combining coarse and fine granularity, characterized in that: include: Step S10, obtaining the best K value under the limitation of the legal value of the R tree, using the K-Means algorithm on the basis of the best K value, performing unsupervised classification on the three-dimensional building model data with a single building as the basic unit, ensuring the legality of the R tree node, and then performing a tree balancing operation to ensure the balance of the R tree, and obtaining the R tree leaf node containing multiple single building data through multiple recursive iterations; Step S20, using an octree to organize a single building in fine granularity, and creating an octree root node for each building at the R tree leaf node; The monomer model data is assigned to the octree nodes, and the redundant nodes are deleted, and finally the 3D building model data organization structure that integrates the R-tree and the octree is obtained.
2. The method for organizing a three-dimensional building model combining coarse and fine granularity according to claim 1, characterized in that: The step S10 comprises the following steps: Step S101, initializing the R tree, creating a root node, and inputting a three-dimensional building model with a single building as the basic unit; Step S102, determine the number of buildings passed in, if it is greater than the maximum legal entry value M of the R-tree node, go to step S103, if it is less than or equal to M, go to step S107; Step S103, obtaining the best K value K-Value under the legal value limit of the R tree; Step S104, executing the K-means clustering algorithm when the K value is K-Value, to obtain a clustering data array Clusters; Step S105, performing a tree balancing operation, adjusting the number of buildings in each cluster in the cluster data array Clusters to an average value, and obtaining a balanced cluster array bClusters; Step S106, judging whether the balanced cluster array bClusters has completed the loop, if not, reading the clusters in the array, creating the child node childNode of the current node, and entering step S102, the data passed in is the three-dimensional building model data with a single building as the basic unit in the current cluster; if the loop is completed, entering step S108; Step S107, inserting the single building data into the current node, completing the update of the bounding box of each node of the R-tree; Step S108, recursively complete the loop of all other balanced clustering arrays to obtain an R-tree structure with a single building as the basic unit.
3. The method for organizing a three-dimensional building model combining coarse and fine granularity according to claim 2, characterized in that: The step S103 comprises the following steps: S1031, under the constraints of MaxK and maxDelta, find the best K value K1 by comparing the SSE values; S1032, if the K1 value is less than the minimum legal entry value m of the R-tree node, then the most appropriate K value K-Value value is m; if m≤K1≤M, then the K-Value value is K1; S1033, calculate the building tree N, that is, the total number of buildings in the current node, such as Add 1 to the K-Value until Stop when , and get the best K value K-Value under the legal value limit of the R-tree.
4. The method for organizing a three-dimensional building model combining coarse and fine granularity according to claim 1, characterized in that: The step S20 comprises the following steps: Step S201, obtaining an R-tree structure with a single building as a basic unit, and determining whether the leaf nodes of the R-tree have been looped; when the loop is not completed, proceeding to the next step; when the loop is completed, a three-dimensional building model data structure integrating the R-tree and the octree is obtained; Step S202, creating a root node of an octree according to the leaf nodes of the R-tree, and obtaining a minimum cubic bounding box of a single building as the range of the root node of the octree; Step S203, judging whether the single body model of the current building has been inserted, if the insertion is completed, proceeding to step S207; if the insertion is not completed, proceeding to step S204; Step S204, judging whether the expansion value of the current node is less than the minimum area threshold Minl of the octree partitioning. When the current node is less than Minl, the judgment is stopped, the current node is inserted, and then the process returns to step S203 for re-judgment. On the contrary, when the current node is greater than or equal to Minl, the octree partitioning is performed and the process proceeds to step S205. Step S205, when the single building model is surrounded by the current node area, but not by any child node area of the current node, the current node is inserted, and then the process returns to step S203 for re-judgment; otherwise, the process proceeds to the next step, i.e., step S206; Step S206, when the single building model is surrounded by the current node area and any child node area of the current node, the child node is set as the current node and the process goes to step S204; Step S207, deleting non-essential nodes, which are blank nodes. If a child node and its sibling nodes have neither child nodes nor data, all child nodes pointed to by the parent node in the child node are deleted.
5. The method for organizing a three-dimensional building model combining coarse and fine granularity according to claim 1, characterized in that: The three-dimensional building model data organization structure integrating R-tree and octree includes: root nodes, intermediate nodes and leaf nodes of R-tree and octree, wherein the root node and intermediate nodes of R-tree do not contain pointers to the root node of octree, and the pointer array OcPtrs pointing to the root node of octree is empty; and the leaf node of R-tree does not contain pointers to other child nodes, and Children is empty; the root node of octree is located at the top layer, that is, it does not point to any parent node, and its Parent value is empty; when entering the root node, the building identification value BuildID is only recorded once, the intermediate node and leaf node do not store the BuildID value, the leaf node does not contain a pointer to the child node, and Children is empty.
6. A three-dimensional architectural model organization device combining coarse and fine granularity, characterized in that: include: The R-tree coarse-grained organization module obtains the optimal K value under the limitation of the legal value of the R-tree, and then uses the K-Means algorithm based on the optimal K value to perform unsupervised classification on the three-dimensional building model data with a single building as the basic unit to ensure the legality of the R-tree node, and then performs a tree balancing operation to ensure the balance of the R-tree. Through multiple recursive iterations, the R-tree tree child nodes containing multiple single building data are obtained; The octree fine-grained organization module is used to organize a single building in a fine-grained manner using an octree. At the R-tree leaf node, an octree root node is created for each building. The monomer model data is assigned to the octree nodes, and the redundant nodes are deleted, and finally a data organization structure that integrates the R-tree and the octree is obtained.
7. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program, when running, executes the coarse-grained and fine-grained combined three-dimensional building model organization method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the coarse-grained and fine-grained combined three-dimensional building model organization method according to any one of claims 1 to 5.
9. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the coarse-grained and fine-grained combined three-dimensional building model organization method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Granularity balance data organization method of complicated three-dimensional building model
CN105957148A
Fractal dimension calculation method and device based on octree algorithm
CN112991424A
Large irregular stockpile volume real-time measurement method based on binocular stereo matching
CN118134994A
Octree grid construction method and device, equipment and storage medium
CN119068119A
A method for forming a neural network architecture for classifying an object given in the form of a point cloud, a method for using it for training the neural network and searching for semantically similar point clouds
RU2017105394A
