Space partitioning and ray tracing method based on multi-layer quadtree
By using a multi-level quadtree adaptive spatial partitioning method, the problems of high computational complexity and low efficiency of ray tracing algorithms in complex industrial scenarios are solved, and more efficient radio wave prediction is achieved.
Patent Information
- Application Number
- CN202310727275.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-19
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2043-06-19
AI Technical Summary
Existing ray tracing algorithms suffer from high computational complexity, numerous useless intersection operations, and low computational efficiency in complex industrial scenarios. Existing spatial partitioning methods are unable to accurately adjust the level of partitioning fineness and lack adaptability.
A spatial partitioning method based on multi-level quadtrees is adopted to perform three-dimensional modeling of the space within a set range and to divide it into layers in the vertical direction. The quadtree is used for adaptive partitioning, and the threshold is dynamically adjusted to adapt to the distribution of objects, thereby reducing the number of intersection operations.
It improves the computational efficiency and accuracy of the ray tracing algorithm, adapts to changes in complex industrial scenarios, reduces useless intersection operations, and enhances the algorithm's flexibility and adaptability.
Smart Images

Figure CN116805352B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of radio technology, and in particular to a spatial partitioning and ray tracing method based on a multi-level quadtree. Background Technology
[0002] With the rapid development of new-generation electronic information technology, the level of information technology in industrial environments is constantly increasing. The large number of electronic devices results in extremely dense electromagnetic signals in open factory spaces, creating a highly complex electromagnetic environment. In such industrial sites, such as petrochemical, power, and automobile manufacturing industries, accurate prediction of radio wave propagation is crucial for a deep understanding of the electromagnetic situation and electromagnetic compatibility characteristics of the industrial site, thus becoming one of the hot topics in modern mobile communication technology research.
[0003] Currently, radio wave propagation prediction methods mainly fall into three categories: empirical models, deterministic models, and semi-empirical / semi-deterministic models that fall between the two. For the characteristics of microcells, researchers have proposed deterministic models, which are a class of deterministic models derived through theoretical analysis and research of radio waves. Common examples of deterministic models include the Finite-Difference Time-Domain (FDTD) method, the Measured Equation of Invariance (MEI) method, and Ray Tracing (RT). In recent years, ray tracing algorithms have been widely applied to radio wave propagation prediction, wireless network planning, and wireless base station positioning. While this traditional ray tracing method can adapt to radio wave prediction in complex environments, its enormous computational load leads to reduced computational efficiency. Therefore, improving the computational efficiency of ray tracing has become a major research focus for many researchers.
[0004] In the face of complex and unique industrial environments, the large number of unnecessary intersection calculations is one of the main factors affecting the computational efficiency of ray tracing methods. Therefore, the industry has been seeking ways to significantly reduce the number of unnecessary intersection point calculations to improve computational efficiency while maintaining the accuracy of ray tracing algorithms. Currently, some partitioned ray tracing acceleration techniques, such as mesh-based methods and triangular partitioning methods, adaptively divide the object's face into small partitions according to the distribution of the number of wedges. Rays entering a specific partition only need to perform intersection calculations with the faces and wedges within that partition; rays not entering a partition simply skip that partition. This simplifies the industrial environment model to some extent, reduces the number of calculations, and improves the efficiency of the ray tracing algorithm.
[0005] Mesh-based methods represent objects in a scene as mesh models and then perform intersection detection on the mesh. The advantage of this method is that it can quickly perform intersection detection and works well for irregularly shaped objects, but it requires significant computational resources.
[0006] The triangular partitioning method uses triangles to divide areas, based on the faces and wedges within each area. This information is incorporated into the partitioning process; specifically, based on the shape of an object, the wedges of the object within the area are used as vertices of the partition, and the faces of the object are used as edges. Thus, a ray entering a triangular partition only needs to be checked for intersection with the three edges and three vertices. However, this partitioning method is very flexible and requires specific partitioning tools. Implementing such partitioning in practice is difficult, and it is primarily used in two-dimensional applications, not in three-dimensional area models.
[0007] Current ray tracing acceleration techniques based on spatial partitioning all have some drawbacks, as described below:
[0008] Granularity and fineness of spatial partitioning: Different granularities of spatial partitioning directly affect the computational efficiency and accuracy of ray tracing. If the partitioning is too coarse, many objects in the scene that do not need to be calculated will be included, wasting computational resources; if the partitioning is too fine, the computational load of spatial segmentation will increase, leading to a decrease in computational efficiency. Some existing techniques cannot precisely adjust the fineness of partitioning, thus affecting the final ray tracing acceleration effect.
[0009] The degree of adaptability of spatial partitioning methods: Different scenes and objects have different characteristics. When there are a large number of repetitive objects in a scene, existing ray tracing acceleration techniques based on spatial partitioning are difficult to effectively optimize for all scenes and objects and cannot adaptively adjust the size of the partitions. Therefore, they lack flexibility and adaptability.
[0010] In summary, existing spatial partitioning-based ray tracing acceleration techniques suffer from issues related to the granularity of spatial partitioning, the complexity of object shapes, the dynamic updating of spatial partitions, and the adaptability of spatial partitioning methods. These shortcomings severely limit the computational efficiency and accuracy of ray tracing techniques when handling large and complex scenes, necessitating further research and optimization. Summary of the Invention
[0011] In view of this, the purpose of this invention is to propose a spatial partitioning and ray tracing method based on multi-level quadtrees, which can effectively solve the problems of high computational complexity, a large number of useless intersection operations, and low computational efficiency of traditional ray tracing algorithms when performing radio wave prediction in complex industrial scenarios.
[0012] To achieve the above objectives, the present invention provides a spatial partitioning method based on a multi-level quadtree, comprising:
[0013] Perform 3D modeling of a space within a defined range;
[0014] The space is divided into layers in the vertical direction based on the modeling results;
[0015] For each layer of space in the hierarchical result, the surfaces and wedges of the objects contained in that layer are adaptively partitioned based on a quadtree.
[0016] Preferably, the adaptive partitioning of the surfaces and wedges of the objects contained in the layer space based on a quadtree is specifically as follows:
[0017] The layer space is evenly divided into 4 subspaces, and the 4 subspaces are used as the spatial grid in the partitioning result of the first partitioning, which correspond to the 4 leaf nodes of the quadtree with the root node respectively.
[0018] This layer of space is then further partitioned multiple times; one partitioning process is as follows:
[0019] For each spatial grid in the partitioning result of the previous partitioning, if the total number of object surfaces and wedges contained in the spatial grid is greater than a threshold, then the spatial grid is uniformly divided into 4 subspaces, which correspond to the 4 leaf nodes of the quadtree respectively. The common parent node of these 4 leaf nodes is the node of the spatial grid in the quadtree. The 4 subspaces are used as the spatial grids in the partitioning result of this partitioning.
[0020] The threshold is dynamically calculated based on the total number of surfaces and wedges of objects contained in the current spatial grid to be segmented.
[0021] Preferably, the method further includes: storing information about the object's surface and wedge as corresponding nodes of the quadtree.
[0022] Determine the nodes corresponding to the smallest spatial grid that completely contains the object;
[0023] The information about the object's surface and wedge is stored as a corresponding node.
[0024] Preferably, the method further includes: pruning the quadtree.
[0025] Determine that there are no nodes in the quadtree that store information about the surface and wedge of the corresponding object;
[0026] Remove the identified node from the quadtree.
[0027] Preferably, the method further includes: encoding the nodes of the quadtree:
[0028] For the current node to be encoded, the last digit of the node is used as the last digit in the final codeword, and the codeword of its parent node is used as the first digit in the final codeword.
[0029] The tail codes of the four leaf nodes of the same parent node are 0, 1, 2, and 3, respectively.
[0030] The present invention also provides a ray tracing method, comprising:
[0031] For a ray to be tracked, for the current layer of the spatial layering result of the defined range, determine the spatial grid where the source point of the ray is located.
[0032] A spatial grid of the partitioned space within the defined range is used; and the ray is tracked within this spatial grid.
[0033] Determine the node corresponding to the spatial grid in the quadtree;
[0034] Based on the propagation direction of the ray and the information of the object's surface and wedge stored at the corresponding node, the intersection calculation between the ray and the object's surface and wedge is performed.
[0035] The propagation direction of the ray after reflection or diffraction, and the exit point of the ray in the spatial grid are determined based on the intersection calculation results.
[0036] After completing the tracking of the ray within the spatial grid, if it is determined that the ray does not meet the tracking termination condition, then...
[0037] The adjacent spatial grid into which the ray enters is determined based on the ray's propagation direction and the exit point of the spatial grid; then, the ray continues to be tracked in the adjacent spatial grid.
[0038] The present invention also provides a computer device, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described spatial partitioning or ray tracing method based on a multi-level quadtree.
[0039] The present invention also provides a computer-readable storage medium storing a computer program that can be executed by at least one processor to perform the steps of the above-described spatial partitioning or ray tracing method based on a multi-level quadtree.
[0040] In this invention, a three-dimensional model of a defined spatial range is performed. Based on the modeling results, the space is layered vertically. For each layer, the surfaces and wedges of objects within that layer are adaptively partitioned using a quadtree. By layering the three-dimensional model of the defined spatial range and then adaptively dividing each layer into multiple quadtree nodes, the entire region is divided, reducing the number of intersection calculations between rays and object wedges in the ray tracing algorithm and improving computational efficiency. Furthermore, this method has a certain dynamic update capability, adapting to dynamic changes in the number of objects in the scene, allowing for flexible processing and further improving the accuracy of ray tracing. Therefore, this invention has advantages such as simplicity, efficiency, ease of implementation, flexibility, and strong adaptability. It effectively solves the problems of high computational complexity, numerous useless intersection calculations, and low computational efficiency of traditional ray tracing algorithms when predicting radio waves in complex industrial scenarios. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 A flowchart of a spatial partitioning method based on a multi-level quadtree provided in Embodiment 1 of the present invention;
[0043] Figure 2 This is a schematic diagram of a traditional quadtree spatial partitioning provided in Embodiment 1 of the present invention;
[0044] Figure 3 A flowchart of a method for adaptive partitioning of the surface and wedge of an object contained in a single layer of space based on a quadtree, as provided in Embodiment 1 of the present invention;
[0045] Figure 4 This is a schematic diagram of spatial grid coding provided in Embodiment 1 of the present invention;
[0046] Figure 5 This is a schematic diagram of the improved quadtree structure provided in Embodiment 1 of the present invention;
[0047] Figure 6 This is a flowchart of a ray tracing method within a defined spatial range, provided in Embodiment 2 of the present invention.
[0048] Figure 7 This is a schematic diagram of a computer device hardware structure provided in Embodiment 3 of the present invention. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0050] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms "first," "second," and similar terms used in this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0051] The inventors of this invention have discovered that, to address the shortcomings of the aforementioned technical solutions, this invention proposes a ray tracing acceleration method based on multi-level quadtree adaptive spatial partitioning. This optimizes traditional spatial partitioning techniques, further reduces the number of intersection operations, and thus improves the efficiency of the ray tracing algorithm. To solve the time and space overhead problem of constructing multiple quadtree structures, this invention employs an adaptive spatial partitioning method for quadtrees. The quadtree partitioning method is dynamically adjusted according to the density and distribution of objects in the scene to achieve better results. Furthermore, to improve the efficiency of intersection detection, this invention adopts a hierarchical approach, dividing the 3D space into multiple levels, each with a different quadtree, thereby handling complex 3D scenes and improving algorithm efficiency. Simultaneously, this invention will also employ other optimization techniques, such as hierarchical search acceleration, data structure preprocessing, and even combining machine learning techniques to further enhance the acceleration effect of ray tracing.
[0052] To address the issue of inefficient ray tracing algorithms due to the complex and varied distribution of buildings in industrial settings, which often results in numerous unnecessary intersection operations, this technique addresses this problem. The 3D model of the industrial scene is vertically layered, and each layer is adaptively partitioned into quadtree spaces, resulting in multiple quadtree nodes. Each node contains facet information of a certain number of geometric objects within a corresponding range, thus decomposing the scene into smaller subspaces. During ray tracing, only the facet information of geometric objects stored in the nodes corresponding to the intersections with the ray needs to be considered, without needing to consider the facet information of all other objects in the entire scene. This reduces the number of intersection operations, lowers the computational complexity of ray tracing in 3D industrial environments, and improves the algorithm's efficiency.
[0053] By analyzing the equipment distribution characteristics and physical environment features of industrial sites such as petrochemical, power, and automobile manufacturing, we found that cables and various pipes are low and densely distributed, workshops and factory buildings are relatively tall but flat, while chimneys and tower cranes are sparsely distributed but extremely tall. The uneven distribution and large height range of buildings and equipment in complex industrial 3D scenes make traditional surface-based partitioning methods unsuitable for large-scale complex factory areas. Therefore, a single spatial partitioning method cannot meet the requirements of multi-source heterogeneous 3D data. To address the object distribution in these various industrial environments, we adopted a layered approach, dividing the 3D model of the factory into three layers vertically. The surface information of objects in each layer is stored using a quadtree partitioning method: the first layer contains cables and pipes with a height of 0 to 10m; the second layer contains workshops and factory buildings with a height of 10 to 30m; and the third layer contains chimneys and tower cranes with a height of over 30m. Furthermore, during the quadtree partitioning process at each layer, we do not need to construct a full quadtree. Instead, we adopt an adaptive spatial partitioning approach to dynamically subdivide cells, thus proposing a ray tracing acceleration method based on multi-layer quadtree adaptive spatial partitioning.
[0054] To overcome the shortcomings of traditional ray tracing algorithms in complex electromagnetic environments, such as numerous useless intersection operations and low operating efficiency, this invention aims to propose a multi-layer quadtree adaptive spatial partitioning ray tracing acceleration method suitable for industrial scenarios by analyzing the characteristics of radio wave propagation environments. This method reduces the number of intersections between rays and object surfaces, lowers the computational complexity of ray tracing in 3D industrial plant environments, and improves the efficiency of the algorithm.
[0055] The technical solutions of the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0056] Example 1
[0057] Embodiment 1 of the present invention provides a spatial partitioning method based on a multi-level quadtree, the specific process of which is as follows: Figure 1 As shown, it includes the following steps:
[0058] Step S101: Perform 3D modeling of the space within the defined range;
[0059] Specifically, a three-dimensional model is performed on a defined space, such as a given industrial site, including the geometric and morphological models (material properties) of objects within the space, in order to construct a geographic environment information database suitable for ray tracing; a cuboid that completely contains the three-dimensional model is defined, its coordinate system is determined, and the minimum coordinate value point of the model is located at the origin through coordinate translation, and the relevant information of the entire model is initialized to facilitate subsequent intersection and field strength calculations.
[0060] If the current industrial site environment is a typical microcell, then predicting radio wave propagation using ray tracing technology requires prior acquisition of relevant terrain geometry information and surface and wedge information of objects. Therefore, a 3D model of the given industrial site is necessary, which forms the basis for the subsequent development of an electromagnetic visualization software platform. The information required by the ray tracing algorithm mainly includes the geometric description, morphological description, and other descriptions of the scene area, and therefore needs to be carefully considered during 3D modeling.
[0061] The geometric descriptions in industrial scenarios are quite complex, including objects such as buildings, oil tanks, pipelines, chimneys, and tower cranes. Information such as their geometric shapes, location coordinates, altitudes, and building materials is required. In real-world scenarios, these objects are numerous and difficult to describe, necessitating appropriate simplification of the propagation environment without compromising prediction accuracy. For example, firstly, only the exterior wall information of buildings is considered, with altitudes set vertically; secondly, considering the actual industrial environment, the ground can be treated as flat; finally, for highly irregular objects such as oil tanks or pipelines, they can be approximated using bounding boxes, equivalent to regular cuboids or cylinders. The morphological descriptions in industrial scenarios primarily involve the electromagnetic properties of the object's surface materials. These properties can be found in relevant literature or obtained through measurement and calculation methods, including complex relative permittivity, complex relative permeability, conductivity, reflection coefficient, and diffraction coefficient. To improve the accuracy of radio wave propagation prediction using ray tracing, it is necessary to consider the electromagnetic properties of the ground and geometric objects, as these directly affect reflection, diffraction, and energy levels. Furthermore, to further enhance the model's refinement and ray tracing accuracy, on-site investigations of other data from industrial sites such as petrochemical, power, and automotive manufacturing are required to obtain optimal results. Firstly, texture data can be directly acquired from aerial photography, satellite remote sensing, and terrestrial photography, and then processed using algorithms to extract textures from building rooftops and facades. Secondly, industrial manufacturers need to provide planning and design drawings, topographic maps, and other materials for 3D modeling reference.
[0062] This solution defines a cube in three-dimensional space that completely encompasses the defined spatial range (current industrial scenario). A three-dimensional Cartesian coordinate system is used, and the cube is translated so that the minimum coordinates of the model to be calculated are at the origin (0,0,0). The three edges of the cube coincide with the x, y, and z axes of the coordinate system, respectively, and have a side length of 2. nFurthermore, to meet the requirements of ray tracing and localization in radio wave propagation prediction, all the aforementioned model information must be stored as vector data. Based on the various descriptions in the 3D model given above, an environmental information database suitable for ray tracing can be created for the current industrial scene. In this database, we describe the factory environment using closed directed polygons, simplifying all objects into combinations of facets, and extracting information from facets, wedges, and vertices for calculation. This allows us to view radio wave propagation in the current industrial scene as a combination of direct, reflected, and diffracted waves, and obtain the propagation path through ray tracing. Specifically, we number each edge and vertex of an object in a counter-clockwise order, mapping the edge numbers to the vertex numbers to simplify the process of finding visible faces and visible wedges. Thus, the database stores each edge as a record, each record as a node, and each node's information includes the start and end coordinates and number of the edge. The data for the entire industrial plant is stored in the form of a singly linked list. Next, the wedges of the object are stored in a linked list in counter-clockwise order. This tells us the vertex number and coordinates of each object, the facet number and vertex of each object, the wedge tip number of each object, and the vertex and wedge face. This information can be used to determine the surface and wedge tip information of the partitioned object. After this, the relevant information of the model can be initialized, including the following parts:
[0063] Initialize the fixed reference point information and obtain the spatial three-dimensional coordinate data of the signal transmitter.
[0064] Initialize the positioning reference signal information and obtain the signal's characteristic parameters;
[0065] Initialize target node information and acquire spatial three-dimensional coordinate data of the signal receiver;
[0066] Initialize spatial information and acquire data on the environment that affect signal propagation, including the surface composition, surface equation parameters, and reflection (diffraction) coefficients of buildings in space.
[0067] Step S102: Based on the modeling results, the space is divided into layers in the vertical direction;
[0068] In this step, the 3D model is layered according to the height distribution characteristics of objects within the defined space (current industrial scene), and the layers are numbered from bottom to top. The initial elevation of each layer is set, the model information of each layer within its height range is determined, and data outside the height range is removed to ensure that there is no overlap between layers.
[0069] Specifically, considering the height distribution characteristics of objects in the aforementioned industrial scenario, a layered approach was adopted. The 3D model of the factory was divided into three layers vertically, numbered from bottom to top. Subsequently, the face information of objects in each layer was partitioned and stored using a quadtree: the first layer consists of oil tanks and pipes, with a height of 0 to 10m, numbered layer 0, and called the lower layer; the second layer consists of factory buildings and other structures, with a height of 10 to 30m, numbered layer 1, and called the middle layer; the third layer consists of chimneys and tower cranes, with a height of over 30m, numbered layer 2, and called the upper layer.
[0070] After the initial layer numbering is completed, the initial elevation of each layer needs to be set. According to the layer structure described above, the initial elevation z0 of the first layer is 0m, where the object's elevation coordinate h is the initial elevation z0 plus the coordinate z of its layer. The initial elevation z1 of the second layer is 10m, where the object's elevation coordinate h is the initial elevation z1 plus the coordinate z of its layer. The initial elevation z2 of the third layer is 30m, where the object's elevation coordinate h is the initial elevation z2 plus the coordinate z of its layer. Next, the model information for each layer within its elevation range needs to be determined. A model database for each layer is constructed based on the object's elevation coordinates. This means that the surfaces (or facets), wedges, and vertices of objects whose elevation coordinates are within the layer's range are retained in the corresponding numbered database, while data outside the range is removed, thus ensuring no overlap between layers. In this way, three 3D model databases with different elevation information are obtained. Each database stores the surface (or facet) and wedge information of objects within its corresponding layer, thus dividing the current industrial scene's 3D model into three main parts based on elevation.
[0071] Step S103: For each layer of space in the layered result, adaptively partition the surfaces and wedges of the objects contained in that layer of space based on a quadtree;
[0072] In this step, the space of each layer is further divided into partitions based on the existing layering.
[0073] Traditional quadtree space partitioning, such as Figure 2As shown, the entire space is uniformly divided into four subspaces, each with a side length half that of the original space, and each subspace uniquely corresponds to a code. If the number of surfaces and wedges of objects in a subspace exceeds a pre-set threshold, that subspace will be further divided into smaller grid cells until the total number of surfaces and wedges in the region represented by each leaf node of the quadtree is less than the threshold. The set threshold can adjust the depth of the quadtree. A larger threshold results in a shallower quadtree depth and higher efficiency in traversing the quadtree, but a greater computational cost for intersection operations. Conversely, a smaller threshold results in a deeper quadtree depth and lower efficiency in traversing the quadtree, but a relatively smaller computational cost for intersection operations. Therefore, choosing a reasonable threshold is crucial.
[0074] In traditional quadtree partitioning, a given threshold is set, and the number of object surfaces in each subspace (or small partition) is compared with the threshold to determine whether the subspace needs further subdivision. If the number is greater than the threshold, the region is further divided into four; otherwise, if the number is less than or equal to the threshold, the region is partitioned. This is a recursive process. Typically, the threshold is a fixed parameter used to control the number of objects in each node or the size of the node. However, in real-world industrial scenarios such as petrochemicals, power generation, and automobile manufacturing, some small partitions have excessively dense object distribution. If the threshold is too large, the region will not be further subdivided. Conversely, some small partitions have sparse object distribution. If the threshold is too small, the region will be continuously subdivided, resulting in unnecessary waste. This leads to extreme imbalance in the quadtree, with the depth being too shallow or too deep, increasing the number of intersection operations and reducing the algorithm's efficiency. Considering that the distribution and density of objects may vary in different regions, the inventors of this invention found that a fixed threshold may not meet practical needs.
[0075] Based on the above analysis, this invention introduces a new recursive partitioning strategy, using this new evaluation system as the partitioning basis to improve the flexibility of partitioning. In the improved quadtree partitioning method, a dynamic threshold is set to adapt to the distribution density of objects in different subspaces, thereby further improving the efficiency and accuracy of partitioning. Specifically, by continuously observing the distribution of objects and the size of nodes in the subspace, the threshold parameter is dynamically adjusted so that the number of objects in each node and the node size are always within a suitable range. When the number of objects in the subspace corresponding to a node exceeds the threshold, the node is split into four child nodes; otherwise, the nodes are merged into a single parent node. If objects in some subspaces are very dense, lowering the threshold can better characterize these areas and further subdivide them; conversely, if objects in some subspaces are very sparse, increasing the threshold can reduce unnecessary partitioning. As can be seen from the above analysis, setting a dynamic threshold during the spatial partitioning process allows the granularity of spatial partitioning to be dynamically adjusted, exhibiting strong adaptability to different object numbers and complex environmental layouts. Avoiding overly coarse partitioning, which would include many objects in the scene that don't need calculation, wasting computational resources; and avoiding overly fine partitioning, which would increase the computational load of spatial segmentation and reduce computational efficiency. Therefore, compared to some existing techniques that cannot precisely adjust the fineness of partitioning, this approach can improve the final ray tracing acceleration effect.
[0076] In this step, the specific method for adaptively partitioning the surfaces and wedges of objects within a single layer of the layered result using a quadtree is as follows: Figure 3 As shown, it includes the following sub-steps:
[0077] Sub-step S301: Perform the first partitioning of this layer space;
[0078] In this sub-step, the iteration number i = 1 is set; the layer space is evenly divided into 4 subspaces, and the 4 subspaces obtained by the division are used as the space grid in the partitioning result of the i-th partitioning, which respectively correspond to the 4 leaf nodes of the quadtree with the root node.
[0079] Furthermore, after setting i = i + 1, the space is iteratively partitioned multiple times in subsequent sub-steps:
[0080] Sub-step S302: During the partitioning process of the i-th iteration, for each spatial grid in the partitioning result of the previous partitioning, perform another partitioning;
[0081] Specifically, during the partitioning process of the i-th iteration, for each spatial grid in the partitioning result of the previous partitioning, it is determined whether the total number of surfaces and wedges of the objects contained in the spatial grid is greater than a threshold.
[0082] If so, the spatial grid is evenly divided into 4 subspaces, each corresponding to one of the 4 leaf nodes of the quadtree. The common parent node of these 4 leaf nodes is the node of the spatial grid in the quadtree. The 4 subspaces are used as the spatial grids in the partitioning result of this partitioning.
[0083] Otherwise, the spatial grid will not be segmented.
[0084] The threshold is dynamically calculated based on the total number of object surfaces and wedges contained in the current spatial mesh to be segmented. For example, if the dynamic threshold is represented by N, and the number of object surfaces and wedges in the spatial mesh to be segmented is represented by num, then the threshold can be selected according to the following rules:
[0085]
[0086] The above formula is only a preliminary result of the threshold selection. In the future, we can use deep learning methods to find a dynamic threshold that minimizes the number of intersection operations, so as to further optimize the algorithm.
[0087] Sub-step S303: If no spatial grid is partitioned during the partitioning process of the i-th iteration, then end the partitioning; otherwise, let i = i + 1, jump to sub-step S302, and continue the next partitioning.
[0088] Step S104: Encode the nodes of the quadtree;
[0089] In this step, for each layer of space in the layered result, the nodes of the quadtree of that layer are encoded, that is, the spatial grid corresponding to the node is encoded.
[0090] The inventors of this invention considered that in traditional quadtree partitioning, the commonly used encoding method is to represent the spatial grid in which an object is located by the coordinates of the nodes or the positional relationship of the nodes. Generally, the row and column numbers or coordinate values of the nodes can be used for encoding. By comparing the coordinates of the object and the positional relationship of the nodes, the spatial grid in which the object is located can be determined.
[0091] As a better implementation method, the technical solution of the present invention adopts a novel quadtree partitioning encoding method, which can be used to quickly convert between coordinates and encoding. The coordinates of the lower left corner of the spatial grid and the depth of the quadtree can be obtained according to the relationship between the encoding of the spatial grid (i.e., the corresponding node) and the coordinates, so as to facilitate subsequent algorithm traversal.
[0092] In the encoding method used in this step, the tail codes of the four leaf nodes of the same parent node are four single-digit numbers, such as 0, 1, 2, and 3 respectively. Then, in the final codeword of the leaf node encoding, the tail code of the leaf node is used as the last digit, and the codeword of its parent node is used as the first digit. The resulting encoding of the spatial grid corresponding to the node is as follows: Figure 4 As shown.
[0093] Assume the maximum depth of the quadtree is N, where N ≤ n (N represents the number of partitioning levels); where n is the maximum encoding length of the spatial grid (i.e., the corresponding node's encoding); define an array q[i] to store the encodings of the spatial grids, where i < N, and initialize q[i] = 0. Whenever the quadtree depth increases by 1, assign values 0, 1, 2, 3 to the end of the array based on the position of the spatial grid. Then, the encoding corresponding to any final partitioned spatial grid is q1q2…q N Here, q1, q2, ..., q N ∈{0,1,……,3}. Based on the degree of spatial grid subdivision, the final numbering result is as follows: Figure 4 As shown, because each space is divided into 4 parts, resulting in a total of N layers, an N-bit code is formed, which can uniquely represent any minimum-sized spatial grid. Therefore, for any point with known coordinates in the spatial grid, the code of its spatial grid can be directly obtained from the coordinates; at the same time, if the code of any spatial grid is known, its lower left corner coordinates can also be directly obtained, thus facilitating the partitioning of areas and the positioning of object surfaces and wedges, making the ray tracing algorithm faster and more efficient. For a point A(x,y) in the top view of each layer of the model, the code of its spatial grid can be quickly obtained from the coordinates using the following method:
[0094] First, round x and y to the nearest integer; then represent the values of x and y in binary, i.e., x = i1i2…i n y = j1j2...j n , where i l ,j l ∈{0,1}, l=1,2,...,n; thus, the code of the spatial grid where point A is located is q1q2...q N , where q l =i l +2j l , l=1,2,...,N.
[0095] After obtaining the N-bit encoding of the spatial grid and its corresponding x and y axis coordinates, the quadtree depth corresponding to each spatial grid is also obtained. Furthermore, since the model is three-dimensional, the z-axis coordinate of the spatial grid is the initial elevation z of that spatial layer.initial .
[0096] Accordingly, if a spatial grid is known to be coded as q1q2...q N Then the coordinates of the lower left corner of the spatial grid (x l ,y d ,z f As shown below:
[0097] x l =i1i2…i N 0...0
[0098]
[0099] The number of trailing zeros is (nN).
[0100] Step S105: Store the information of the object's surface and wedge as corresponding nodes of the quadtree;
[0101] In this step, for an object in space, the smallest spatial grid that completely contains the object is determined; then the node corresponding to the spatial grid is determined; and the information of the object's surface and wedge is stored corresponding to the node.
[0102] Specifically, after completing the quadtree-based adaptive spatial partitioning and encoding of a layer of space, a traversal method is used to accurately determine the spatial grid to which each object belongs and its encoding within that layer of space. This involves calculating the intersection points of the planar line segments along the object's edges with the boundaries of the spatial grid, identifying the spatial grids containing all intersection points, and recognizing that the object has passed through that grid. Finally, the encoding of the object's spatial grid is obtained. If there are no intersection points, the method determines which side of the boundary the line segment is on. By identifying the partitions containing the intersection points and line segments, the spatial grid to which the object belongs is determined, thus obtaining the spatial grid number to which each object belongs.
[0103] Furthermore, the information about the surface or wedge of the objects assigned to each network space is stored in the corresponding quadtree nodes. In addition, since an adaptive quadtree spatial partitioning was performed on each layer of the 3D model, each layer corresponds to one quadtree.
[0104] When storing object surface vector information, closed directed polygons can be used to describe the environment of a small region. This involves storing the object's geometric information as edges, and numbering each edge and vertex in a counter-clockwise order. This ensures a one-to-one correspondence between edge and vertex numbers, simplifying the search for visible faces and wedges, facilitating ray intersection calculations, and subsequent backface culling. Similarly, storing wedge vector information can also be done in a counter-clockwise order. In this way, each record in the database represents the information for each edge and wedge, with the record's number and coordinates stored in a node of a quadtree.
[0105] Quadtrees have a relatively simple structure and offer high efficiency for spatial data insertion and retrieval when objects are evenly distributed in space. Therefore, quadtrees are one of the commonly used spatial indexes in GIS. A traditional quadtree structure is as follows: Figure 2 As shown, geospatial objects are stored in leaf nodes, while intermediate and root nodes do not store geospatial objects. However, if spatial objects are unevenly distributed, the quadtree's hierarchy will deepen with each insertion, resulting in a severely unbalanced quadtree. This significantly increases the depth of each query, drastically reducing query traversal efficiency. Furthermore, the same geospatial object may be stored in multiple nodes during quadtree splitting, leading to wasted index space.
[0106] To address the aforementioned shortcomings, this invention employs an improved quadtree index structure. The corresponding improvement involves storing the information of geospatial objects in the smallest cube grid node that completely contains them, rather than in their parent or child nodes. Each object is stored only once in this quadtree, avoiding wasted storage space. First, a full quadtree can be generated, avoiding the need for memory reallocation during the insertion of geospatial objects, thus speeding up the insertion process. Finally, unused node space is released through pruning operations. The improved quadtree structure is as follows: Figure 5 As shown, the depth of a quadtree is generally best taken as an empirical value between 4 and 7.
[0107] Thus, three quadtrees with improved index structures have been constructed, each storing industrial site environment information within its corresponding height range. In this quadtree structure, each child node corresponds to a spatial grid in the scene and contains the face wedge data information of objects within that grid. Subsequently, by traversing these three quadtrees, the face wedge information in the model at the corresponding level can be obtained, enabling rapid intersection calculations.
[0108] Step S106: Prune the quadtree;
[0109] In this step, nodes in the quadtree that do not store information about the surface and wedge of the corresponding object are identified; these identified nodes are then pruned from the quadtree. This releases unused node space through pruning.
[0110] Step S107: Based on the final partitioning result, perform ray tracing within the space defined in the set range.
[0111] Example 2
[0112] The core of ray tracing algorithms is to find the actual intersection points between the ray and the object's surface, which are used to determine the reflection and diffraction points, thereby calculating the reflection and diffraction fields. In traditional ray tracing methods, the ray needs to intersect with the surfaces of all objects within a defined scene area to determine the actual intersection point, thus a significant amount of time is spent on intersection calculations. The key to ray tracing methods incorporating spatial partitioning acceleration technology is that all objects within the defined scene area are divided into multiple partitions. The ray only needs to intersect with the surfaces of objects within the current propagation partition, greatly reducing the number of irrelevant intersection calculations. This invention accelerates traditional ray tracing methods by incorporating the aforementioned spatial partitioning concept.
[0113] First, design an algorithm capable of traversing and searching a single quadtree. This algorithm can be recursive or iterative. Define the operations to be performed during traversal: based on the encoding of the spatial grid where the ray source point is located, read the surface and wedge information of the object stored in the corresponding quadtree node. Then, implement an entry point for the traversal algorithm through a loop, allowing it to accept the root node of a quadtree as a parameter and call the designed traversal algorithm to traverse that quadtree, instead of starting directly from the root node. Next, when traversing the next quadtree, pass its root node as a parameter to the entry point of the traversal algorithm, thus using this loop to traverse each quadtree. Finally, when traversing multiple quadtrees, consider the different structures of each quadtree. Therefore, when accessing each node, we need to check if the current node is a leaf node to avoid accessing non-existent child nodes, and we also need to handle the data types and operations of nodes in different quadtrees.
[0114] Currently, the primary algorithm used is the forward ray tracing algorithm. The traditional method involves emitting a large number of ray beams uniformly from a source point into the surrounding space, then tracing the path of each ray beam individually. At the receiving point, a receiving sphere is used to determine whether the ray beam contributes to the field strength at that point. Tracking continues until the field strength attenuates to a negligible level or below a set threshold. The next ray beam is then tracked, and this process is repeated until all ray beams have been tracked. Therefore, we combine the aforementioned multi-level quadtree adaptive spatial partitioning with the forward ray tracing algorithm, thereby accelerating the ray tracing process and improving computational efficiency by utilizing the concepts of layering and partitioning.
[0115] It's important to note that spatial partitioning employs a multi-level quadtree adaptive partitioning algorithm to rationally divide the current industrial scene into regions. This is typically used before the intersection calculation between rays and object surfaces. Ray tracing is then performed, determining if the ray intersects with the current spatial grid in the scene. If no intersection occurs, the spatial grid is temporarily ignored. For intersecting spatial grids, intersection calculations are performed with object surfaces within the region. If an intersection point exists, the ray undergoes appropriate propagation mechanisms such as reflection or diffraction. If no intersection point exists, or if the spatial grid contains no object surfaces or wedges, the ray continues propagating forward in its original direction, entering the next adjacent sub-partition, and repeating the intersection determination process. Ray tracing ends when the ray reaches the boundary of the scene region or when the field strength attenuates to a pre-set threshold.
[0116] The forward ray tracing search algorithm involves emitting a large number of pre-defined ray beams uniformly from the source point into the surrounding space. Each ray beam's path is then tracked individually. At the receiving point, a receiving sphere is used to determine whether the ray beam contributes to the field strength. The determination method is to check if the distance between the ray beam and the receiving point is greater than the radius of the receiving sphere. If this distance is greater, the ray beam is considered not to contribute to the field strength at that point, and the next threshold condition is applied. If the distance is less than the radius, it is considered to contribute, and the ray beam's contribution is added to the total field strength at that point. The ray beam is then tracked until its field strength decays to a negligible level or below a set threshold. The next ray beam is then tracked, and the process is repeated until all ray beams have been tracked. Therefore, this scheme combines the aforementioned multi-layer quadtree adaptive spatial partitioning with the traditional forward ray tracing algorithm, thereby accelerating the ray tracing process and improving computational efficiency by utilizing the concepts of layering and partitioning.
[0117] When performing forward ray tracing, we can traverse each quadtree in breadth-first order according to its hierarchical number. After searching one quadtree, we continue searching the next, until all the necessary quadtrees have been traversed. By searching such a multi-quadtree index structure, we can access the face split information stored in each node, which facilitates subsequent ray intersection calculations with the face splits.
[0118] Based on the above-described spatial partitioning method using multi-level quadtrees, the second embodiment of this invention provides a ray tracing method within a defined spatial range. For a ray to be tracked, the method searches the quadtree corresponding to the current layer of the hierarchical result to perform ray tracing for that layer. The specific flow of this ray tracing method is as follows: Figure 6 As shown, it includes the following steps:
[0119] Step S601: For a ray to be tracked, determine the spatial grid where the source point of the ray is located in this layer of space;
[0120] In this step, for a ray to be tracked, for the current layer of the spatial layering result of the set range, the spatial grid where the source point of the ray is located is determined: the layer of the spatial layering result and the code of the spatial grid are calculated based on the current source point coordinates (x,y,h). The height coordinate h can determine which layer of the spatial layering result it is in, and the code of the spatial grid can be determined by the top view coordinates (x,y).
[0121] Step S602: Track the ray within the defined spatial grid;
[0122] Specifically, the node corresponding to the spatial grid in the corresponding quadtree is determined by: calculating the layer of the layered result and the code of the spatial grid based on the current source point coordinates (x, y, h). The height coordinate h can determine which layer of the layered result it is in, and the code of the spatial grid can be determined by the top view coordinates (x, y), thus obtaining the depth of the quadtree; thereby, the corresponding node in the corresponding quadtree is determined.
[0123] Furthermore, based on the propagation direction of the ray and the information of the object's surface and wedge stored at the corresponding node, the intersection calculation between the ray and the object's surface and wedge is performed; based on the intersection calculation result, the propagation direction of the ray after reflection or diffraction, as well as the exit point of the ray in the spatial grid, is determined, thereby realizing the tracking of the ray in the spatial grid.
[0124] Step S603: Determine whether the ray meets the tracking termination condition; if not, continue to execute the following step S604; if yes, execute step S606 to end the tracking of the ray in this layer space.
[0125] Specifically, if the ray satisfies the following conditions, it is determined that the ray meets the tracking termination condition: the coordinates of the exit point of the current spatial grid are located on the boundary of the space within the set range, or the ray energy decays to below the set threshold, or the tracked ray reaches the receiving position.
[0126] If the ray does not meet the tracking termination condition, then proceed to step S604 to continue tracking the ray; otherwise, proceed to step S606 to terminate the tracking of the ray.
[0127] Step S604: Determine the adjacent spatial grid into which the ray enters based on the propagation direction of the ray and the exit point of the spatial grid;
[0128] Step S605: After continuing to track the ray in the adjacent spatial grid, proceed to step S603;
[0129] Specifically, the coordinates of the entry point of the ray entering the spatial grid are determined; the entry point is taken as the source point of the ray in the spatial grid; the node corresponding to the spatial grid in the quadtree is determined; based on the coordinates of the source point, the propagation direction of the ray when it enters the spatial grid, and the information of the object's surface and wedge stored at the corresponding node, the intersection calculation of the ray with the object's surface and wedge is performed; based on the intersection calculation, the propagation direction of the ray after reflection or diffraction, and the exit point of the ray in the spatial grid are determined, thereby realizing the tracking of the ray in the spatial grid.
[0130] Step S606: End the tracking of this ray and switch to tracking the next ray.
[0131] In traditional forward ray tracing algorithms, a ray needs to intersect with all object surfaces in 3D space, and the computational load increases exponentially with the model complexity. However, after layering and partitioning the industrial scene, the algorithm traverses the obtained quadtree data structure during ray tracing calculations. Only when the ray intersects with the current sub-partition will it enter the corresponding child node, search for the stored face and cleft information, and perform intersection calculations with them. If there is no intersection, the child node is skipped, the sub-partition is discarded, and the algorithm searches for face and cleft information in the child node of the next sub-partition. This reduces the number of intersection calculations and, to a certain extent, simplifies the model of the electromagnetic propagation environment.
[0132] As industrial site environmental models become larger and more complex, this multi-level quadtree adaptive spatial partitioning method demonstrates its advantages over existing mesh-based and triangular partitioning methods. Firstly, the adaptive partitioning scheme allows for adjustable spatial partition granularity, avoiding both overly coarse partitioning that wastes computational resources and overly fine partitioning that increases the computational load of spatial segmentation. Secondly, adaptively adjusting the partition size provides greater flexibility and adaptability. This addresses the existing spatial partitioning-based ray tracing acceleration techniques' problems with spatial partition granularity, object shape complexity, dynamic updating of spatial partitions, and the adaptability of the spatial partitioning method.
[0133] In other words, the spatial partitioning based on multi-level quadtrees in this invention is well-suited for three-dimensional micro-area models. This allows for the acquisition of ray paths within the entire complex electromagnetic environment model. Furthermore, by utilizing Geometrical Theory of Diffraction (GTD) and Uniform Theory of Diffraction (UTD), the field strength is calculated. The total field strength is obtained by vector superposition of the field strength of each ray path, enabling the prediction of radio wave propagation in industrial environments such as petrochemical, power, and automotive manufacturing. This effectively solves the problems of high computational complexity, numerous useless intersection operations, and low computational efficiency associated with traditional ray tracing algorithms for radio wave prediction in complex industrial scenarios.
[0134] In summary, this invention proposes a spatial partitioning method and ray tracing method based on multi-level quadtrees. By layering the 3D model of the industrial site and then adaptively dividing each layer into multiple quadtree nodes, the entire region is partitioned. This reduces the number of intersection calculations between rays and object surfaces in the ray tracing algorithm, improving computational efficiency. Furthermore, this method has a certain dynamic update capability, adapting to dynamic changes in the number of objects in the scene, allowing for flexible processing and further improving the accuracy of ray tracing. Therefore, the solution proposed in this invention has advantages such as simplicity, efficiency, ease of implementation, flexibility, and strong adaptability, and can be applied to fields such as computer graphics, virtual reality, and game development.
[0135] In summary, the ray tracing acceleration technique based on multi-level quadtree adaptive spatial partitioning offers advantages such as more detailed spatial division, improved computational efficiency and accuracy, and ease of combining bounding boxes and adaptive multi-level quadtrees. It is applicable to various scenes and object shapes, demonstrating high practical value. Our method, based on the complex and varied building distribution characteristics of industrial scenes, adaptively partitions the 3D factory environment model and utilizes a quadtree index structure to store the facets and wedge information for traversing each small spatial partition, effectively reducing the number of intersection operations. Furthermore, subsequent integration with parallel computing and other multi-threading techniques can improve the utilization of computer resources, further enhancing the efficiency of the ray tracing algorithm under multi-core GPU acceleration.
[0136] The multi-level quadtree spatial partitioning technique proposed in this solution for industrial scenarios can significantly reduce the number of intersections between rays and object surfaces in traditional ray tracing algorithms, thereby reducing the computational complexity of the algorithm and improving the efficiency of ray tracing. This greatly helps to accelerate the operation of our electromagnetic visualization software platform and effectively improves the contradiction between prediction accuracy and computational efficiency in the deterministic ray tracing model.
[0137] Example 3
[0138] Figure 7 This illustration schematically depicts the hardware architecture of a computer device 1300 based on a multi-level quadtree-based spatial partitioning or ray tracing method according to an embodiment of this application. In this embodiment, the computer device 1300 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. For example, it may be a smartphone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server, or cabinet server (including standalone servers or server clusters composed of multiple servers), etc. Figure 7 As shown, the computer device 1300 includes, but is not limited to, at least: a memory 1310, a processor 1320, and a network interface 1330 that can communicate with each other via a system bus. Wherein:
[0139] The memory 1310 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 1310 may be an internal storage module of the computer device 1300, such as the hard disk or memory of the computer device 1300. In other embodiments, the memory 1310 may also be an external storage device of the computer device 1300, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 1310 may also include both the internal storage module and the external storage device of the computer device 1300. In this embodiment, the memory 1310 is typically used to store the operating system and various application software installed on the computer device 1300, such as program code based on multi-level quadtree spatial partitioning or ray tracing methods. In addition, the memory 1310 can also be used to temporarily store various types of data that have been output or will be output.
[0140] In some embodiments, processor 1320 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. Processor 1320 is typically used to control the overall operation of computer device 1300, such as performing control and processing related to data interaction or communication with computer device 1300. In this embodiment, processor 1320 is used to run program code stored in memory 1310 or process data.
[0141] Network interface 1330 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 1300 and other computer devices. For example, network interface 1330 is used to connect computer device 1300 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 1300 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.
[0142] It should be pointed out that, Figure 7 Only computer devices with components 1310-1330 are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0143] In this embodiment, the spatial partitioning or ray tracing method based on a multi-level quadtree stored in memory 1310 can be further divided into one or more program modules and executed by one or more processors (processor 1320 in this embodiment) to complete the embodiment of this application.
[0144] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0145] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this disclosure (including the claims) is limited to these examples; within the framework of this invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in the details for the sake of brevity.
[0146] Additionally, to simplify the description and discussion, and to avoid obscuring the invention, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the invention, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the invention will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) are set forth to describe exemplary embodiments of the invention, it will be apparent to those skilled in the art that the invention may be practiced without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0147] Although the invention has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0148] The embodiments of this invention are intended to cover all such substitutions, modifications, and variations falling within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A spatial partitioning method based on a multi-level quadtree, characterized in that, include: Perform 3D modeling of a space within a defined range; The space is divided into layers in the vertical direction based on the modeling results; For each layer in the hierarchical result, the surfaces and wedges of the objects contained in that layer are adaptively partitioned based on a quadtree: The layer space is evenly divided into 4 subspaces, and the 4 subspaces are used as the spatial grid in the partitioning result of the first partitioning, which correspond to the 4 leaf nodes of the quadtree with the root node respectively. This layer of space is then further partitioned multiple times; one partitioning process is as follows: For each spatial grid in the partitioning result of the previous partitioning, if the total number of object surfaces and wedges contained in the spatial grid is greater than a threshold, then the spatial grid is uniformly divided into 4 subspaces, which correspond to the 4 leaf nodes of the quadtree respectively. The common parent node of these 4 leaf nodes is the node of the spatial grid in the quadtree. The 4 subspaces are used as the spatial grids in the partitioning result of this partitioning. The threshold is dynamically calculated based on the total number of surfaces and wedges of objects contained in the current spatial grid to be segmented.
2. The method according to claim 1, characterized in that, Also includes: The information about the object's surface and wedge is stored as nodes in the quadtree: Determine the nodes corresponding to the smallest spatial grid that completely contains the object; The information about the object's surface and wedge is stored as a corresponding node.
3. The method according to claim 2, characterized in that, Also includes: Prune the quadtree: Determine that there are no nodes in the quadtree that store information about the surface and wedge of the corresponding object; Remove the identified node from the quadtree.
4. The method according to claim 1, characterized in that, Also includes: Encode the nodes of the quadtree: For the current node to be encoded, the last digit of the node is used as the last digit in the final codeword, and the codeword of its parent node is used as the first digit in the final codeword. The tail codes of the four leaf nodes of the same parent node are 0, 1, 2, and 3, respectively.
5. The method according to claim 1, characterized in that, Also includes: Based on the final partitioning results, ray tracing is performed within the defined spatial range.
6. A ray tracing method, applied to a space within a defined range of spatial partitioning as described in any one of claims 1-5, characterized in that, include: For a ray to be tracked, for the current layer of the spatial layering result of the defined range, determine the spatial grid where the source point of the ray is located. Track the ray within this spatial grid: Determine the node corresponding to the spatial grid in the quadtree; Based on the propagation direction of the ray and the information of the object's surface and wedge stored at the corresponding node, the intersection calculation between the ray and the object's surface and wedge is performed. The propagation direction of the ray after reflection or diffraction, and the exit point of the ray in the spatial grid are determined based on the intersection calculation results. After completing the tracking of the ray within the spatial grid, if it is determined that the ray does not meet the tracking termination condition, then... The adjacent spatial grid into which the ray enters is determined based on the ray's propagation direction and the exit point of the spatial grid; then, the ray continues to be tracked in the adjacent spatial grid.
7. The method according to claim 6, characterized in that, The step of continuing to track the ray in the adjacent spatial grid specifically includes: Determine the coordinates of the entry point where the ray enters the spatial grid; The entry point is used as the source point of the ray in the spatial grid. Determine the node corresponding to the spatial grid in the quadtree; Based on the coordinates of the source point, the propagation direction of the ray when it enters the spatial grid, and the information of the object's surface and wedge stored at the corresponding node, the intersection calculation of the ray with the object's surface and wedge is performed. The direction of propagation of the ray after reflection or diffraction, as well as the exit point of the ray in the spatial grid, are determined by the intersection calculation. After completing the tracking of the ray in the spatial grid, determine whether the ray meets the tracking termination condition; If so, end the tracking of that ray; Otherwise, the next spatial grid into which the ray enters is determined based on the direction of its propagation.
8. A computer device, the computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it is used to implement the steps of the method described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by at least one processor to cause the at least one processor to perform the steps of the method according to any one of claims 1 to 7.
