Method for processing and searching for objects in two-dimensional planar scene
Patent Information
- Application Number
- CN202280088833.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-03-07
AI Technical Summary
In two-dimensional plane scenes, especially in the case of large-scale and wide-range object distribution, the existing R-tree and HV tree have insufficient query efficiency, resulting in low regional query performance.
By dynamically cutting the space, combining the structures of HV tree and R tree, dynamically adjusting the cutting direction and tree structure according to the number of objects, building a Rhv tree structure to store objects, and then using the combination of cutting tree and R tree to search during query.
It significantly improves the regional query performance of large data volume objects, improves query efficiency by 30%-50%, and is suitable for scenarios with small data volumes and also significantly improves query performance.
Smart Images

Figure CN118541684A
Abstract
Description
Method for processing and searching for objects in a two-dimensional planar scene Technical Field
[0001] Embodiments of the present disclosure generally relate to the field of object processing and searching in two-dimensional plane scenes, and more specifically, to a method for processing objects in a two-dimensional plane scene, a method for searching for objects in a two-dimensional plane scene, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In IC design, computer-aided design (CAD) software is now used to complete the functional design, synthesis, verification, layout, and routing of very large-scale integrated circuit (VLSI) chips. A crucial operation in the layout and layout process is region query (or region search), which requires quickly finding objects that intersect a given rectangular search box. For example, when zooming and panning in a graphical user interface (GUI), it is necessary to quickly retrieve and display all objects within the search box. These objects are the bounding rectangles of numerous electronic devices.
[0003] Region querying in a two-dimensional scene can be abstracted into the following problem: Given a set of polygons (e.g., rectangles) of varying sizes and random positions in space, input a search box, and output a set of rectangles that intersect the search box. Figure 1 shows the objects and the search box in a two-dimensional scene. As shown in Figure 1, the solid rectangular bounding box 101 represents the large number of objects given before the query, and the dashed rectangular bounding box 102 represents the search box. The region query algorithm then needs to return the eight solid rectangular bounding boxes 101 that intersect the search box 102, i.e., the eight objects.
[0004] The most intuitive solution to the aforementioned area query problem is to traverse all objects and determine whether each object intersects with the search box. However, the complexity of this query method is O(N), where N is the number of objects. As the data size increases, the search process takes a linearly longer time. Therefore, an efficient data structure is needed to store these objects based on their positional relationships. Currently, there are many data structures that can be used for area queries, among which the more efficient ones are R-trees (also known as rectangular trees) and HV-trees (also known as horizontal / vertical trees).
[0005] When objects are widely distributed in an R-tree, the rectangular objects between parent nodes tend to overlap, which affects query efficiency. Furthermore, each insertion and deletion of an object causes changes in the bounding rectangle, and the R-tree must maintain balance. Therefore, the R-tree structure is relatively inefficient in inserting and deleting objects.
[0006] For HV trees, when the object data size is large, the number of objects on the cut line of the HV tree will be large, and the number of cuts will increase significantly, resulting in an increase in the number of nodes and reduced query efficiency. In addition, when there is severe object overlap, query efficiency will be affected because there is no upper limit on the number of objects that can be on a cut node of the cut tree.
[0007] Therefore, there is a need for a solution for efficient object search in two-dimensional scenes.
[0008] Summary of the Invention
[0009] Embodiments of the present disclosure provide a method for processing objects in a two-dimensional plane scene, a method for searching for objects in a two-dimensional plane scene, an electronic device, a computer-readable storage medium, and a computer program product, aiming to solve the problem of low query efficiency in scenes where the data scale of objects in a two-dimensional plane scene is large and the distribution range is wide, as well as other potential problems.
[0010] According to a first aspect of the present disclosure, a method for processing objects in a two-dimensional plane scene is provided, the method comprising: determining whether the number of objects in a predetermined space of the two-dimensional plane scene exceeds a threshold; in response to the number of objects in the predetermined space exceeding the threshold, cutting the predetermined space with a cutting line having a first extension direction to divide the predetermined space into two subspaces; constructing the objects on the cutting line having the first extension direction into a cutting tree in an HV tree structure; determining whether the number of objects in each subspace exceeds the threshold; in response to the number of objects in the corresponding subspace not exceeding the threshold, constructing the objects in the corresponding subspace into an R tree; and in response to the number of objects in the corresponding subspace exceeding the threshold, changing the cutting direction, and further dividing the corresponding subspace into two subspaces with a cutting line having a second extension direction perpendicular to the first extension direction.
[0011] By utilizing the tree-structured object storage constructed according to the embodiments of this disclosure, the problem of low efficiency in regional queries for large amounts of objects can be resolved. For scenarios with large amounts of object data, a wide distribution area, and significant local overlap, using this tree-structured object storage method is expected to improve query performance by 30%-50% compared to other object storage methods. This can also significantly improve query performance for regional queries on smaller amounts of data.
[0012] In some embodiments, the method further includes: in response to the number of objects in the predetermined space not exceeding the threshold, constructing the objects in the predetermined space into an R-tree.
[0013] In some embodiments, the predetermined space is the entire space of the two-dimensional plane scene or a subspace obtained by cutting the entire space of the two-dimensional plane scene one or more times.
[0014] In some embodiments, constructing the objects on the cutting line with the first extension direction into a cutting tree in the HV tree structure includes at least one of the following: constructing the objects on the cutting line with the first extension direction into a binary search tree; and sorting the objects on the cutting line with the first extension direction using an array.
[0015] In some embodiments, the method also includes: constructing the objects on the cutting line having the second extension direction into a cutting tree in the HV tree structure; judging whether the number of objects in each of the two subspaces obtained by further dividing the corresponding subspace exceeds the threshold; in response to the number of objects in the corresponding subspace not exceeding the threshold, constructing the objects in the corresponding subspace into an R tree; and in response to the number of objects in the corresponding subspace exceeding the threshold, changing the cutting direction and further dividing the corresponding subspace into two subspaces using the cutting line having the first extension direction.
[0016] In some embodiments, constructing the objects on the cutting line with the second extension direction into a cutting tree in the HV tree structure includes at least one of the following: constructing the objects on the cutting line with the second extension direction into a binary search tree; and sorting the objects on the cutting line with the second extension direction using an array.
[0017] In some embodiments, constructing the objects in the corresponding subspace into an R-tree includes: aggregating a predetermined number of objects in the corresponding subspace that are close in distance.
[0018] In some embodiments, the method further includes: in response to all objects in the entire space of the two-dimensional plane scene being already in corresponding tree nodes, outputting a tree structure consisting of the cut tree and the R-tree.
[0019] In some embodiments, the first extension direction is one of a horizontal extension direction and a vertical extension direction, and the second extension direction is the other of the horizontal extension direction and the vertical extension direction.
[0020] In some embodiments, the two-dimensional plane scene includes at least one of an IC chip design scene, a map query scene, and a pixel retrieval scene.
[0021] According to a second aspect of the present disclosure, a method for searching for objects in a two-dimensional plane scene is provided, wherein objects in the entire space of the two-dimensional plane scene are constructed into a tree structure, the tree structure including cut nodes and leaf nodes, each cut point pointing to a first subtree, a second subtree, and a cut tree in an HV tree structure, each cut tree storing objects on a cut line, and each leaf node pointing to an R tree, the method comprising: inputting a search box into the tree structure; determining whether the current node is the cut node; in response to the current node being not the cut node but the leaf node, searching for objects in the R tree pointed to by the current node using the search box; and in response to the current node being the cut node, searching for objects in the cut tree pointed to by the current node using the search box.
[0022] By searching for objects in a tree structure according to the embodiments of the present disclosure, the problem of low efficiency in regional queries for large amounts of objects can be solved. For scenarios with large amounts of object data, a wide distribution area, and significant local overlap, this query method is expected to improve query performance by 30%-50% compared to other object query methods. It can also significantly improve query performance for regional queries on smaller amounts of data.
[0023] In some embodiments, the method further includes: in response to the current node being the cutting node, determining whether the cutting line corresponding to the current node passes through the search box; in response to the cutting line corresponding to the current node passing through the search box, using the search box to search for objects in both the first subtree and the second subtree pointed to by the current node; and in response to the cutting line corresponding to the current node not passing through the search box, using the search box to search for objects in the subtrees of the first subtree and the second subtree pointed to by the current node that intersect with the search box.
[0024] In some embodiments, using the search box to search for objects in both the first subtree and the second subtree pointed to by the current node includes: determining whether the root node of each subtree in the first subtree and the second subtree is the cut node; in response to the corresponding root node being not the cut node but the leaf node, using the search box to search for objects in the R tree pointed to by the corresponding root node; and in response to the corresponding root node being the cut node, using the search box to search for objects in the cut tree pointed to by the corresponding root node.
[0025] In some embodiments, searching for objects in both the first subtree and the second subtree pointed to by the current node using the search box also includes: in response to the corresponding root node being the cutting node, determining whether the cutting line corresponding to the corresponding root node passes through the search box; in response to the cutting line corresponding to the corresponding root node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the corresponding root node using the search box; and in response to the cutting line corresponding to the corresponding root node not passing through the search box, searching for objects in the subtrees in the first subtree and the second subtree pointed to by the corresponding root node that intersect with the search box using the search box.
[0026] In some embodiments, searching for objects in the subtrees intersecting with the search box in the first subtree and the second subtree pointed to by the current node using the search box includes: determining whether the root node of the subtrees intersecting with the search box in the first subtree and the second subtree is the cut node; in response to the root node being not the cut node but the leaf node, searching for objects in the R-tree pointed to by the root node using the search box; and in response to the root node being the cut node, searching for objects in the cut tree pointed to by the root node using the search box.
[0027] In some embodiments, searching for objects in the subtrees of the first subtree and the second subtree pointed to by the current node using the search box also includes: in response to the root node being the cutting node, determining whether the cutting line corresponding to the root node passes through the search box; in response to the cutting line corresponding to the root node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the root node using the search box; and in response to the cutting line corresponding to the root node not passing through the search box, searching for objects in the subtrees of the first subtree and the second subtree pointed to by the root node using the search box that intersect with the search box.
[0028] In some embodiments, searching for an object in the cut tree pointed to by the current node using the search box includes: searching for the object on the root node of the cut tree; if the search box intersects with the bounding rectangle of the left subtree of the cut tree, searching for the object in the left subtree; and if the search box intersects with the bounding rectangle of the right subtree of the cut tree, searching for the object in the right subtree.
[0029] In some embodiments, the current node is a root node or a child node of the tree structure.
[0030] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory coupled to the processor and comprising instructions stored thereon, wherein the instructions, when executed by the processor, cause the electronic device to perform a method according to the first aspect or the second aspect of the present disclosure.
[0031] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which machine-executable instructions are stored. When the machine-executable instructions are executed by at least one processor, the at least one processor implements the method according to the first aspect or the second aspect of the present disclosure.
[0032] According to a fifth aspect of the present disclosure, a computer program product is provided, which is tangibly stored in a computer-readable storage medium and includes machine-executable instructions, which, when executed by a device, cause the device to perform the method according to the first aspect or the second aspect of the present disclosure.
[0033] This summary is provided to introduce a selection of concepts in a simplified form that will be further described in the detailed description below. It is not intended to identify key features or essential features of the disclosure, nor is it intended to limit the scope of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The above and other objects, features and advantages of the embodiments of the present disclosure will become readily understood by reading the following detailed description with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown by way of example and not limitation.
[0035] FIG1 shows objects and a search box in a two-dimensional plane scene.
[0036] FIG2 shows a flowchart of a method for processing an object in a two-dimensional plane scene according to an embodiment of the present disclosure.
[0037] FIG3 shows a schematic diagram of processing an object in a two-dimensional plane scene using a method according to an embodiment of the present disclosure.
[0038] FIG4 shows a tree structure obtained by processing objects in a two-dimensional plane scene using a method according to an embodiment of the present disclosure.
[0039] FIG5 shows a flowchart of a method for searching for an object in a two-dimensional plane scene according to an embodiment of the present disclosure.
[0040] FIG6 shows a flowchart of a method for searching for an object in a two-dimensional plane scene according to another embodiment of the present disclosure.
[0041] FIG7 shows a schematic block diagram of an example device that can be used to implement embodiments of the present disclosure.
[0042] In the various drawings, the same or corresponding reference numerals denote the same or corresponding parts. DETAILED DESCRIPTION
[0043] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0044] The term "including" and its variations used in this document indicate open inclusion, that is, "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one other embodiment". Terms such as "upper", "lower", "front", and "rear" indicating placement or positional relationships are based on the orientation or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the principles of the present disclosure, and do not indicate or imply that the referred elements must have a specific orientation, be constructed or operate in a specific orientation, and therefore should not be understood as limiting the present disclosure.
[0045] As described above, conventional solutions using R-trees and HV-trees to store objects in a two-dimensional plane scene suffer from low query efficiency when querying objects in the two-dimensional plane scene, when the data size of the objects in the two-dimensional plane scene is large and the distribution range is wide. Embodiments of the present disclosure provide a method for processing objects in a two-dimensional plane scene, a method for searching for objects in a two-dimensional plane scene, an electronic device, a computer-readable storage medium, and a computer program product, aiming to address the problem of low query efficiency in scenarios where the data size of the objects in the two-dimensional plane scene is large and the distribution range is wide, as well as other potential problems.
[0046] FIG2 illustrates a flow chart of a method 200 for processing objects in a two-dimensional plane scene according to an embodiment of the present disclosure. FIG3 illustrates a schematic diagram of processing objects in a two-dimensional plane scene using a method according to an embodiment of the present disclosure. FIG4 illustrates a tree structure obtained by processing objects in a two-dimensional plane scene using a method according to an embodiment of the present disclosure. The process of processing objects in a two-dimensional plane scene will be described below with reference to FIG2 through FIG4.
[0047] As shown in Figure 2, a group of objects in the entire space of a two-dimensional plane scene is input at 201. In an embodiment according to the present disclosure, the two-dimensional plane scene can include at least one of an IC chip design scene, a map query scene, and a pixel retrieval scene. The two-dimensional plane scene can contain various objects, such as polygons (such as rectangles). As shown in Figure 3, 16 rectangular objects R1-R16 in the entire space of the two-dimensional plane scene are shown. Hereinafter, objects R1-R16 will be used as examples to describe the principles of the present disclosure. It should be understood that more or fewer objects and / or other types of objects can be included in the entire space of the two-dimensional plane scene, and the scope of the present disclosure is not strictly limited in this respect. In addition, it should be understood that in other embodiments, the two-dimensional plane scene can also be other types of scenes, which contain objects such as polygons (such as rectangles), and the scope of the present disclosure is not strictly limited in this respect.
[0048] At 202, it is determined whether the number of objects in the entire space of the two-dimensional plane scene exceeds a threshold value. If so, step 203 is executed; if not, step 207 is executed. Hereinafter, a threshold value of 4 will be used as an example to describe the principles of the present disclosure. It should be understood that in embodiments according to the present disclosure, the threshold value may be larger or smaller, and the scope of the present disclosure is not strictly limited in this respect. As shown in Figure 3, the entire space of the two-dimensional plane scene contains 16 objects R1-R16. The number of objects exceeds the threshold value of 4, so method 200 will proceed to step 203.
[0049] At 203, in response to the number of objects in the entire space of the two-dimensional plane scene exceeding a threshold, the entire space of the two-dimensional plane scene is cut with a cutting line having a first extension direction to divide the entire space of the two-dimensional plane scene into two subspaces. In an embodiment according to the present disclosure, the first extension direction is one of a horizontal extension direction and a vertical extension direction. As shown in Figure 3, the first extension direction is a horizontal extension direction. The cutting line 301 having a horizontal extension direction divides the entire space of the two-dimensional plane scene into two subspaces 311 and 312. Subspace 311 can also be called an upper space, and subspace 312 can also be called a lower space. In other embodiments, the first extension direction can be a vertical extension direction, that is, the entire space of the two-dimensional plane scene can be cut using a cutting line having a vertical extension direction.
[0050] At 204, the objects on the cutting line with the first extension direction are constructed into a cutting tree in the HV tree structure. As shown in Figure 3, the first extension direction is a horizontal extension direction, and the cutting line 301 with the horizontal extension direction intersects with objects R8, R4, R13 and R16. Here, the objects R8, R4, R13 and R16 on the cutting line 301 with the horizontal extension direction are constructed into a cutting tree in the HV tree structure. As shown in Figure 4, objects R8, R4, R13 and R16 are constructed into a cutting tree 401 in the HV tree structure. Cutting tree 401 is connected to the root node 400 of the entire tree structure, and root node 400 is a cutting node. Object R4 is on the root node 4010 of cutting tree 401, object R8 is on the left subtree of the root node 4010 of cutting tree 401, and objects R13 and R16 are on the right subtree of the root node 4010 of cutting tree 401. In addition, as shown in FIG4 , the root node 400 is also connected to a first subtree 411 and a second subtree 412 .
[0051] In some embodiments, constructing the objects on the cutting line with a first extension direction into a cutting tree in the HV tree structure includes at least one of the following: constructing the objects on the cutting line with the first extension direction into a binary search tree; and sorting the objects on the cutting line with the first extension direction using an array. In other embodiments, other methods may be used to construct the objects on the cutting line with the first extension direction into a cutting tree in the HV tree structure, and the scope of the present disclosure is not strictly limited in this respect.
[0052] At 205, it is determined whether the number of objects in each subspace exceeds a threshold. If so, step 206 is executed; if not, step 207 is executed. As shown in Figure 3, subspace 311 contains objects R1, R2, R3, R5, R6, and R7, totaling 6 objects, exceeding the threshold of 4. Subspace 312 contains objects R9, R10, R11, R14, and R15, totaling 5 objects, exceeding the threshold of 4.
[0053] At 206, in response to the number of objects in the corresponding subspace exceeding a threshold, the cutting direction is switched. As shown in FIG3 , since the number of objects contained in subspace 311 is 6, exceeding the threshold of 4, the cutting direction is switched from horizontal to vertical. Furthermore, since the number of objects contained in subspace 312 is 5, exceeding the threshold of 4, the cutting direction is also switched from horizontal to vertical. Subsequently, at 203, the corresponding subspace is further divided into two subspaces using a cutting line having a second extension direction perpendicular to the first extension direction. As shown in FIG3 , subspace 311 is cut using cutting line 302 having a vertical extension direction, further dividing subspace 311 into two subspaces 3111 and 3112. Similarly, subspace 312 is cut using cutting line 303 having a vertical extension direction, further dividing subspace 312 into two subspaces 3121 and 3122. It should be understood that if the first extension direction is a vertical extension direction, the second extension direction after the switch is a horizontal extension direction.
[0054] Subsequently, at 204, the objects on the cut line 302 having a second extension direction (e.g., a vertical extension direction) are constructed into a cut tree in the HV tree structure, and the objects on the cut line 303 having a vertical extension direction are constructed into a cut tree in the HV tree structure. As shown in Figures 3 and 4, since object R4 has been assigned to cut tree 401, no other objects exist on cut line 302, and only object R12 exists on cut line 303. Therefore, as shown in Figure 4, an empty cut tree 4111 containing no objects is connected to the root node 4110 of the first subtree 411, and a cut tree 4121 containing only object R12 is connected to the root node 4120 of the second subtree 412. The root node 4110 of the first subtree 411 and the root node 4120 of the second subtree 412 are both cut nodes, and the root node 4110 of the first subtree 411 points to the further first subtree 421 and second subtree 422, and the root node 4120 of the second subtree 412 points to the further first subtree 431 and second subtree 432.
[0055] In some embodiments, constructing the objects on the cutting line with the second extension direction into a cutting tree in the HV tree structure includes at least one of the following: constructing the objects on the cutting line with the second extension direction into a binary search tree; and sorting the objects on the cutting line with the second extension direction using an array. In other embodiments, other methods may be used to construct the objects on the cutting line with the second extension direction into a cutting tree in the HV tree structure, and the scope of the present disclosure is not strictly limited in this respect.
[0056] Subsequently, at step 205, for each of the obtained subspaces 3111, 3112, 3121, and 3122, a determination is made as to whether the number of objects in each subspace exceeds a threshold. If so, step 206 is executed; if not, step 207 is executed. As shown in Figure 3, subspace 3111 contains objects R1, R2, and R3, totaling three objects; subspace 3112 contains objects R5, R6, and R7, totaling three objects; subspace 3121 contains objects R9, R10, and R11, totaling three objects; and subspace 3122 contains objects R14 and R15, totaling two objects. Since the number of objects in each subspace does not exceed the threshold of four, the objects in the corresponding subspace are constructed into an R-tree. As shown in Figure 4 , the root nodes 4210, 4220, 4310, and 4320 of the first subtree 421, the second subtree 422, the first subtree 431, and the second subtree 432 are all leaf nodes, pointing to R-trees, respectively. For example, as shown in Figures 3 and 4 , in subspace 3111, two objects R1 and R2 with similar distances are aggregated into a larger rectangle BR1 and stored in the first subtree 421; in subspace 3112, two objects R5 and R6 with similar distances are aggregated into a larger rectangle BR3 and stored in the second subtree 422; in subspace 3121, two objects R9 and R10 with similar distances are aggregated into a larger rectangle BR5 and stored in the first subtree 431; and in subspace 3122, two objects R14 and R15 with similar distances are aggregated into a larger rectangle BR7 and stored in the second subtree 432. The circumscribed rectangle BR2 of the object R3 is stored in the first subtree 421 , the circumscribed rectangle BR6 of the object R11 is stored in the first subtree 431 , and the circumscribed rectangle BR4 of the object R7 is stored in the second subtree 422 .
[0057] At 208 and 209, in response to all objects in the entire space of the two-dimensional planar scene being located in corresponding tree nodes, a tree structure (also referred to as an Rhv tree) consisting of a cut tree and an R-tree is output. FIG4 shows an Rhv tree structure obtained by processing objects in a two-dimensional planar scene using method 200 according to an embodiment of the present disclosure.
[0058] As described above with reference to FIG2 , at step 202, a determination is made as to whether the number of objects in the entire space of the two-dimensional planar scene exceeds a threshold. Furthermore, at step 205, a determination is made as to whether the number of objects in each subspace (which may be a subspace obtained by cutting the entire space of the two-dimensional planar scene one or more times) exceeds a threshold. These two steps can be collectively referred to as determining whether the number of objects in a predetermined space of the two-dimensional planar scene exceeds a threshold. Subsequently, the steps described with reference to FIG2 can be executed based on the determination results.
[0059] In some cases, if it is determined at 202 that the number of objects in the entire space of the two-dimensional plane scene does not exceed a threshold, the objects in the entire space can be directly constructed into an R-tree at 207. At this point, the objects in the two-dimensional plane scene are constructed into a tree structure. By using the tree structure constructed according to the embodiment of the present disclosure to store objects, the problem of low efficiency in regional queries of objects with large amounts of data can be solved. For scenes with large amounts of object data, a wide plane range of object distribution, and severe local overlap, using such a tree structure to store objects can improve the expected query performance by 30%-50% compared to other object storage methods. For regional queries of small amounts of data, the query performance can also be significantly improved.
[0060] Embodiments of the present disclosure also provide a method for searching for objects in a two-dimensional plane scene. Figure 5 shows a flowchart of a method 500 for searching for objects in a two-dimensional plane scene according to an embodiment of the present disclosure. The objects in the entire space of the two-dimensional plane scene have been constructed into a tree structure, such as the Rhv tree described in conjunction with Figures 2 to 4. The contents described above in conjunction with Figures 2 to 4 can be combined here. As shown in Figures 3 and 4, the tree structure includes cut nodes (e.g., nodes 400, 4110, and 4120) and leaf nodes (4210, 4220, 4310, and 4320). Each cut point points to a first subtree (e.g., subtrees 411, 421, and 431), a second subtree (e.g., subtrees 412, 422, and 432), and a cut tree (e.g., cut tree 401, 4111, and 4121) in the HV tree structure. For example, cut node 400 points to first subtree 411, second subtree 412, and cut tree 401; cut node 4110 points to first subtree 421, second subtree 422, and cut tree 4111; and cut node 4120 points to first subtree 431, second subtree 432, and cut tree 4121. Each cut tree stores objects on a cut line (e.g., cut lines 301, 302, and 303). For example, cut tree 401 stores objects on cut line 301; cut tree 4111 stores objects on cut line 302; and cut tree 4121 stores objects on cut line 303. Each leaf node (e.g., nodes 4210, 4220, 4310, and 4320) points to an R-tree. The R-tree pointed to by leaf node 4210 stores objects in subspace 3111. The R-tree pointed to by leaf node 4220 stores objects in subspace 3112. The R-tree pointed to by leaf node 4310 stores objects in subspace 3121. The R-tree pointed to by leaf node 4320 stores objects in subspace 3122.
[0061] As shown in FIG5 , at 501 , a search box is entered into a tree structure, such as the Rhv tree described in conjunction with FIG2 to FIG4 . The search box can be rectangular or in other shapes. When searching, a search is performed from top to bottom in the tree structure.
[0062] At 502, it is determined whether the current node is a cut node. If so, step 504 is executed; if not, step 503 is executed. As shown in FIG4 , when the current node is node 400, 4110, or 4120, it is a cut node, so step 504 is executed; and when the current node is node 4210, 4220, 4310, or 4320, it is a leaf node, not a cut node, so step 503 is executed.
[0063] At 503, in response to the current node being a leaf node rather than a cut node, the search box is used to search for an object in the R-tree pointed to by the current node. As shown in FIG4 , when the current node is any of nodes 4210, 4220, 4310, and 4320, the object is searched in the corresponding R-tree pointed to by the current node.
[0064] At 504, in response to the current node being a cut node, the search box is used to search for an object in the cut tree pointed to by the current node. As shown in FIG4 , when the current node is any of nodes 400, 4110, and 4120, the search box is used to search for an object in the corresponding cut trees 401, 4111, and 4121 pointed to by the current node.
[0065] At 505, in response to the current node being a cut node, it is determined whether the cut line corresponding to the current node passes through the search box. For example, as shown in FIG4 , when the current node is node 400, it is determined whether the cut line 301 corresponding to node 400 passes through the search box; when the current node is node 4110, it is determined whether the cut line 302 corresponding to node 4110 passes through the search box; and when the current node is node 4120, it is determined whether the cut line 303 corresponding to node 4120 passes through the search box.
[0066] At 506, in response to the cut line corresponding to the current node passing through the search box, the search box is used to search for objects in both the first subtree and the second subtree pointed to by the current node. For example, as shown in Figures 3 and 4, when the current node is node 400, if the cut line 301 corresponding to node 400 passes through the search box, the search box is used to search for objects in both the first subtree 411 and the second subtree 412 pointed to by node 400.
[0067] In some embodiments, at 506, searching for objects in both the first subtree and the second subtree pointed to by the current node using a search box includes: determining whether the root node of each subtree in the first subtree and the second subtree is a cut node; in response to the corresponding root node being not a cut node but a leaf node, searching for objects in the R tree pointed to by the corresponding root node using a search box; and in response to the corresponding root node being a cut node, searching for objects in the cut tree pointed to by the corresponding root node using a search box.
[0068] In some embodiments, at 506, searching for objects in both the first subtree and the second subtree pointed to by the current node using the search box also includes: in response to the corresponding root node being a cutting node, determining whether the cutting line corresponding to the corresponding root node passes through the search box; in response to the cutting line corresponding to the corresponding root node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the corresponding root node using the search box; and in response to the cutting line corresponding to the corresponding root node not passing through the search box, searching for objects in the subtrees in the first subtree and the second subtree pointed to by the corresponding root node that intersect with the search box using the search box.
[0069] At 507, in response to the cut line corresponding to the current node not passing through the search box, the search box is used to search for objects in the subtrees of the first subtree and the second subtree pointed to by the current node that intersect with the search box. For example, as shown in Figures 3 and 4, when the current node is node 400, if the cut line 301 corresponding to node 400 does not pass through the search box, the search box is used to search for objects in the subtrees of the first subtree 411 and the second subtree 412 pointed to by node 400 that intersect with the search box, without searching for objects in the other subtrees.
[0070] In some embodiments, at 507, searching for objects in the subtrees intersecting with the search box in the first subtree and the second subtree pointed to by the current node using the search box includes: determining whether the root node of the subtree intersecting with the search box in the first subtree and the second subtree is a cut node; in response to the root node being not a cut node but a leaf node, searching for objects in the R tree pointed to by the root node using the search box; and in response to the root node being a cut node, searching for objects in the cut tree pointed to by the root node using the search box.
[0071] In some embodiments, at 507, searching for objects in the subtrees intersecting with the search box in the first subtree and the second subtree pointed to by the current node using the search box also includes: in response to the root node being a cutting node, determining whether the cutting line corresponding to the root node passes through the search box; in response to the cutting line corresponding to the root node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the root node using the search box; and in response to the cutting line corresponding to the root node not passing through the search box, searching for objects in the subtrees intersecting with the search box in the first subtree and the second subtree pointed to by the root node using the search box.
[0072] After repeating steps 502 to 507 for the root node and each child node of the tree structure, all searched objects that intersect with the search box are output at 508. By searching for objects in a tree structure according to the embodiments of the present disclosure, the problem of low efficiency in regional queries for large amounts of objects can be solved. For scenarios with large amounts of object data, a wide distribution of objects, and significant local overlap, using this query method can improve query performance by an expected 30%-50% compared to other object query methods. It can also significantly improve query performance for regional queries on smaller amounts of data.
[0073] FIG6 illustrates a flow chart of a method 500 for searching for an object in a two-dimensional planar scene according to another embodiment of the present disclosure. The method 500 illustrated in FIG6 is similar to the method 500 illustrated in FIG5 . As shown in FIG6 , in some embodiments, at 504, searching for an object in the cut tree to which the current node points using a search box includes: searching for the object at the root node of the cut tree; if the search box intersects the bounding rectangle of the left subtree of the cut tree, searching for the object in the left subtree; and if the search box intersects the bounding rectangle of the right subtree of the cut tree, searching for the object in the right subtree.
[0074] FIG7 shows a schematic block diagram of a device 1300 that can be used to implement an embodiment of the present disclosure. As shown in FIG7 , the device 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 1302 or loaded from a storage unit 1308 into a random access memory (RAM) 1303. In the RAM 1303, various programs and data required for the operation of the device 1300 can also be stored. The CPU 1301, ROM 1302, and RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0075] Various components in device 1300 are connected to I / O interface 1305, including an input unit 1306, such as a keyboard and mouse; an output unit 1307, such as various types of displays and speakers; a storage unit 1308, such as a magnetic disk and optical disk; and a communication unit 1309, such as a network card, a modem, a wireless communication transceiver, etc. Communication unit 1309 allows device 1300 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0076] The various processes and processing described above, such as method 200 or method 500, may be performed by processing unit 1301. For example, in some embodiments, method 200 or method 500 may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as storage unit 1308. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1300 via ROM 1302 and / or communication unit 1309. When the computer program is loaded into RAM 1303 and executed by CPU 1301, one or more steps of method 200 or method 500 described above may be performed.
[0077] The present disclosure may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0078] Computer-readable storage media can be a tangible device that can hold and store instructions used by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. Computer-readable storage media used herein is not to be interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated by waveguides or other transmission media (for example, light pulses by fiber optic cables), or electrical signals transmitted by wires.
[0079] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0080] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0081] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0082] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0083] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0084] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0085] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technical improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing objects in a two-dimensional plane scene, characterized in that The method comprises: determining whether the number of objects in a predetermined space of the two-dimensional plane scene exceeds a threshold; In response to the number of objects in the predetermined space exceeding the threshold, cutting the predetermined space with a cutting line having a first extension direction to divide the predetermined space into two subspaces; constructing objects on the cutting line having the first extension direction into a cutting tree in an HV tree structure; Determining whether the number of objects in each subspace exceeds the threshold; In response to the number of objects in the corresponding subspace not exceeding the threshold, constructing the objects in the corresponding subspace into an R-tree; and In response to the number of objects in the corresponding subspace exceeding the threshold, the cutting direction is switched, and the corresponding subspace is further divided into two subspaces using a cutting line having a second extension direction perpendicular to the first extension direction.
2. The method according to claim 1, characterized in that The method further includes: in response to the number of objects in the predetermined space not exceeding the threshold, constructing the objects in the predetermined space into an R-tree.
3. The method according to claim 1, characterized in that The predetermined space is the entire space of the two-dimensional plane scene or a subspace obtained by cutting the entire space of the two-dimensional plane scene one or more times.
4. The method according to claim 1, wherein Constructing the objects on the cutting line having the first extension direction into a cutting tree in the HV tree structure includes at least one of the following: constructing objects on the cutting line having the first extension direction into a binary search tree; as well as The objects on the cutting line having the first extension direction are sorted using an array.
5. The method according to claim 1, wherein The method further comprises: constructing objects on the cutting line having the second extension direction into a cutting tree in an HV tree structure; determining whether the number of objects in each of two subspaces obtained by further dividing the corresponding subspace exceeds the threshold; In response to the number of objects in the corresponding subspace not exceeding the threshold, constructing the objects in the corresponding subspace into an R-tree; and In response to the number of objects in the corresponding subspace exceeding the threshold, the cutting direction is switched, and the corresponding subspace is further divided into two subspaces using a cutting line having the first extension direction.
6. The method according to claim 5, characterized in that Constructing the objects on the cutting line having the second extension direction into a cutting tree in the HV tree structure includes at least one of the following: constructing a binary search tree of objects on the cutting line having the second extension direction; as well as The objects on the cutting line having the second extension direction are sorted using an array.
7. The method according to claim 1, characterized in that Constructing the objects in the corresponding subspace into an R-tree includes: A predetermined number of objects with similar distances in the corresponding subspace are clustered.
8. The method according to claim 1, characterized in that The method further comprises: In response to all objects in the entire space of the two-dimensional plane scene being in corresponding tree nodes, a tree structure consisting of the cut tree and the R-tree is output.
9. The method according to claim 1, characterized in that The first extension direction is one of a horizontal extension direction and a vertical extension direction, and the second extension direction is the other of the horizontal extension direction and the vertical extension direction.
10. The method according to claim 1, characterized in that The two-dimensional plane scene includes at least one of an IC chip design scene, a map query scene, and a pixel retrieval scene.
11. A method for searching for objects in a two-dimensional plane scene, wherein the objects in the entire space of the two-dimensional plane scene are constructed into a tree structure, characterized in that: The tree structure includes a cut node and a leaf node, each cut point points to a first subtree, a second subtree, and a cut tree in the HV tree structure, each cut tree stores objects on the cut line, and each leaf node points to an R tree, and the method includes: Enter the search box into the tree structure; Determine whether the current node is the cut node; In response to the current node being not the cut node but the leaf node, searching for an object in the R-tree pointed to by the current node using the search box; and In response to the current node being the cut node, searching for an object in the cut tree pointed to by the current node using the search box.
12. The method according to claim 11, characterized in that The method further comprises: In response to the current node being the cutting node, determining whether a cutting line corresponding to the current node passes through the search box; In response to a cut line corresponding to the current node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the current node using the search box; and In response to the cutting line corresponding to the current node not passing through the search box, the search box is used to search for objects in subtrees intersecting with the search box in the first subtree and the second subtree pointed to by the current node.
13. The method according to claim 12, characterized in that Searching for objects in both the first subtree and the second subtree pointed to by the current node using the search box includes: Determine whether the root node of each subtree in the first subtree and the second subtree is the cut node; In response to the corresponding root node being not the cut node but the leaf node, searching for an object in the R-tree pointed to by the corresponding root node using the search box; and In response to the corresponding root node being the cut node, searching for an object in the cut tree pointed to by the corresponding root node using the search box.
14. The method according to claim 13, characterized in that Searching for objects in both the first subtree and the second subtree pointed to by the current node using the search box further includes: In response to the corresponding root node being the cutting node, determining whether a cutting line corresponding to the corresponding root node passes through the search box; In response to a cut line corresponding to a corresponding root node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the corresponding root node using the search box; and In response to the cutting line corresponding to the corresponding root node not passing through the search box, the search box is used to search for objects in the subtrees of the first subtree and the second subtree pointed to by the corresponding root node that intersect with the search box.
15. The method according to claim 12, characterized in that Searching for an object in a subtree intersecting with the search box in the first subtree and the second subtree pointed to by the current node using the search box includes: Determine whether the root node of the subtree intersecting with the search box in the first subtree and the second subtree is the cut node; In response to the root node being not the cut node but the leaf node, searching for an object in the R-tree pointed to by the root node using the search box; and In response to the root node being the cut node, searching for an object in the cut tree pointed to by the root node using the search box.
16. The method according to claim 15, characterized in that Searching for an object in a subtree intersecting with the search box in the first subtree and the second subtree pointed to by the current node using the search box further includes: In response to the root node being the cutting node, determining whether a cutting line corresponding to the root node passes through the search box; In response to a cutting line corresponding to the root node passing through the search box, searching for objects in both the first subtree and the second subtree pointed to by the root node using the search box; and In response to the cutting line corresponding to the root node not passing through the search box, the search box is used to search for objects in subtrees intersecting with the search box in the first subtree and the second subtree pointed to by the root node.
17. The method according to claim 11, characterized in that Searching for an object in the cut tree pointed to by the current node using the search box includes: Searching for an object at a root node of the cut tree; If the search box intersects the bounding rectangle of the left subtree of the cut tree, searching for an object in the left subtree; and If the search box intersects with the bounding rectangle of the right subtree of the cut tree, the object is searched in the right subtree.
18. The method according to claim 11, characterized in that The current node is the root node or a child node of the tree structure.
19. An electronic device comprising: processor; as well as A memory is coupled to the processor and includes instructions stored thereon, which, when executed by the processor, cause the electronic device to perform the method according to any one of claims 1 to 18.
20. A computer-readable storage medium having machine-executable instructions stored thereon, which, when executed by at least one processor, causes the at least one processor to implement the method according to any one of claims 1 to 18.
21. A computer program product tangibly stored in a computer-readable storage medium and comprising machine-executable instructions that, when executed by a device, cause the device to perform the method according to any one of claims 1-18.
Citation Information
Patent Citations
Spatial index structure tree based method and device for providing results of searching spatial objects
CN103714080A
Quadtree construction method for storing polygon inclusion relation and indexing method
CN111666361A
Data search method, electronic equipment and computer readable storage medium
CN112182311A
Method for judging inside and outside within area
JP1996320938A
Picture partition method and device
WO2020043136A1
